Improve ssl.conf

https://github.com/alexbelgium/hassio-addons/issues/1703
This commit is contained in:
Alexandre
2025-01-08 14:55:11 +01:00
committed by GitHub
parent 0c112e7d89
commit 882ce3ca2a

View File

@@ -1,5 +1,4 @@
server {
server {
listen 9001;
include /etc/nginx/includes/server_params.conf;
@@ -8,6 +7,10 @@
ssl_certificate /ssl/%%certfile%%;
ssl_certificate_key /ssl/%%keyfile%%;
proxy_buffering off;
gzip_static off;
client_max_body_size 0;
location / {
# Proxy pass
proxy_pass http://localhost:9000;
@@ -18,17 +21,25 @@
proxy_set_header Connection "upgrade";
# Improve ip handling
proxy_hide_header X-Powered-By;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Accept-Encoding "";
proxy_read_timeout 90;
# Correct base_url
# Ensure the backend knows the correct host
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Host $host;
# Correct base_url
absolute_redirect off;
sub_filter_once off;
sub_filter_types *;
sub_filter %%base_subpath%% /;
}
# Rewrite URLs in the response
sub_filter localhost:9000 %%BASE_URL%%;
}
}