From b60bbe266b01754cd0f2d4d3a3fe8d2ce360c5ef Mon Sep 17 00:00:00 2001 From: KFilippopolitis Date: Mon, 9 Nov 2026 14:18:36 +0200 Subject: [PATCH 1/2] fix(nginx): forward the ingress request scheme to the backend The backend location sent no X-Forwarded-Proto. TLS ends at the ingress, so $scheme (as the Jupyter locations use) would tell the backend 'http' and DPoP htu checks against 'https://...' never match. Pass the ingress-provided X-Forwarded-Proto through, falling back to $scheme when absent. --- nginx.conf.template | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/nginx.conf.template b/nginx.conf.template index 113273d61..8b194e590 100644 --- a/nginx.conf.template +++ b/nginx.conf.template @@ -1,3 +1,11 @@ +# The backend needs the real request scheme (DPoP `htu` checks and secure cookies). +# TLS ends at the ingress, so nginx itself sees http and `$scheme` would lie; pass the +# ingress-provided value through and fall back to $scheme only when it is absent. +map $http_x_forwarded_proto $mip_forwarded_proto { + default $http_x_forwarded_proto; + '' $scheme; +} + server { listen 80; server_tokens off; @@ -14,6 +22,7 @@ server { proxy_set_header Host $host; 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 $mip_forwarded_proto; } # Angular shell route for the notebook page (must not proxy to JupyterHub). From cc4c95b93ab554f7e70486c634cfbb66eb614d58 Mon Sep 17 00:00:00 2001 From: KFilippopolitis Date: Mon, 9 Nov 2026 16:46:35 +0200 Subject: [PATCH 2/2] fix(nginx): only honour an https X-Forwarded-Proto claim Review feedback on PR #74: pass-through copied whatever arrived, including spoofed values or comma chains. A client 'https' claim is still honoured (only the ingress can be trusted to rewrite the header), but HTTPS casing and 'https,http' chains now normalise to https, and anything else falls back to the container's own scheme. --- nginx.conf.template | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/nginx.conf.template b/nginx.conf.template index 8b194e590..0b0203a48 100644 --- a/nginx.conf.template +++ b/nginx.conf.template @@ -2,8 +2,10 @@ # TLS ends at the ingress, so nginx itself sees http and `$scheme` would lie; pass the # ingress-provided value through and fall back to $scheme only when it is absent. map $http_x_forwarded_proto $mip_forwarded_proto { - default $http_x_forwarded_proto; - '' $scheme; + # Only a real https claim counts; normalises HTTPS and chains like 'https,http'. + # Anything else (spoofed or absent) falls back to the container's own $scheme. + ~*^https https; + default $scheme; } server {