diff --git a/portainer/rootfs/etc/nginx/templates/ingress.gtpl b/portainer/rootfs/etc/nginx/templates/ingress.gtpl index 624449946..5b0c92eb7 100644 --- a/portainer/rootfs/etc/nginx/templates/ingress.gtpl +++ b/portainer/rootfs/etc/nginx/templates/ingress.gtpl @@ -12,7 +12,18 @@ server { proxy_connect_timeout 30m; proxy_send_timeout 30m; proxy_read_timeout 30m; - } + + # 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 ""; + + # Ensure the backend knows the correct host + proxy_set_header Host $http_host; + proxy_set_header X-Forwarded-Host $http_host; +} location /api/websocket/ { proxy_pass {{ .protocol }}://backend/api/websocket/;