Files
hassio-addons/portainer/rootfs/etc/nginx/templates/ingress.gtpl
alexbelgium 30250612e0 fix(portainer): disable nginx gzip re-compression on ingress
Ingress responses were re-gzipped by nginx (default gzip_types includes
text/html), dropping Content-Length and forcing a chunked/streamed
response. That pushes both Supervisor and Core's ingress proxy out of
their buffered relay path into the streaming path, where an
aiohttp-side error surfaces to the browser as a 502 Bad Gateway even
though the addon's own nginx logs a 200. Disabling gzip on the ingress
server block keeps responses identity-encoded with an intact
Content-Length so the relay uses the simpler, more robust buffered
path.

Fixes #2766
2026-07-24 13:55:29 +02:00

25 lines
847 B
Groovy

server {
listen {{ .interface }}:{{ .port }} default_server;
listen {{ .interface }}:9099 default_server;
include /etc/nginx/includes/server_params.conf;
include /etc/nginx/includes/proxy_params.conf;
client_max_body_size 0;
gzip off;
proxy_hide_header X-Frame-Options;
proxy_hide_header Content-Security-Policy;
add_header X-Frame-Options "SAMEORIGIN";
add_header Content-Security-Policy "frame-ancestors *";
location / {
proxy_pass {{ .protocol }}://backend/;
resolver 127.0.0.11 valid=180s;
# These headers must be under location section, if they moved into proxy_params.conf, even if this is valid, they won't work
proxy_set_header Connection $connection_upgrade;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Host $http_host;
}
}