Add config option for trusted proxies.

This commit is contained in:
Fredrik Baberg 2022-12-20 12:42:17 +01:00
parent 8ef95b70ce
commit 21c54686fa
4 changed files with 16 additions and 2 deletions

View File

@ -1,3 +1,9 @@
- 2022.12.03
- Add option for trusted proxies.
- 2022.12.02
- Use image instead of local build.
- 2022.12.01
- Add mode for camera (for testing).
- Set Caddy to trust private ranges on Ingress entry.

View File

@ -1,5 +1,5 @@
name: "3DPrinter-OctoPrint"
version: "2022.12.02"
version: "2022.12.03"
slug: "3dprinter-octoprint"
description: "OctoPrint as an addon, no additional bells and whistles."
url: "https://github.com/fredrikbaberg/home-assistant-addons/tree/main/3dprinter-octoprint"
@ -26,8 +26,10 @@ ports_description:
options:
camera_url: "http://b7aa59c4-camera-mjpg-streamer"
mode: normal
reverse_proxy: ""
schema:
camera_url: "url?"
mode: "list(normal|recovery|reverse_proxy_test|camera)?"
reverse_proxy: "string?"
tmpfs: true
image: ghcr.io/fredrikbaberg/addon-3dprinter-octoprint-{arch}

View File

@ -11,6 +11,10 @@ bashio::var.json \
ingress_entry "$(bashio::addon.ingress_entry)" \
camera_host "$(bashio::config 'camera_url')" \
mode "$(bashio::config 'mode')" \
reverse_proxy "$(bashio::config 'reverse_proxy')" \
| tempio \
-template /usr/share/tempio/caddy/Caddyfile.gtpl \
-out /etc/caddy/Caddyfile
# Make sure file is correctly formatted.
caddy fmt --overwrite /etc/caddy/Caddyfile

View File

@ -41,6 +41,8 @@
# OctoPrint WebUI
:5000 {
reverse_proxy http://127.0.0.1:80 {
header_up X-Scheme {scheme}
{{ if .trusted_proxies }}
trusted_proxies {{ .trusted_proxies }}
{{ end }}
}
}