Repository navigation
fix(nginx): forward the ingress request scheme to the backend - #74
Merged
Merged
Conversation
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.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements the new forwarded-headers item from the laptop sign-in security review (needed by the backend's DPoP
htucheck, platform-backend PR #53, and W4 in the OWASP audit).The
/${PLATFORM_BACKEND_CONTEXT}/location setHost,X-Real-IPandX-Forwarded-Forbut noX-Forwarded-Proto.Copying the Jupyter locations'
$schemewould be wrong in Kubernetes: TLS ends at the ingress, nginx seeshttp, and the backend's DPoPhtucomparisons (https://…) would never match.The template is included at http context, so the
mapsits above theserverblock:and the backend location sends
X-Forwarded-Proto $mip_forwarded_proto.No Dockerfile/entrypoint change needed (template-only;
envsubst's restricted variable list leaves the map's$variablesuntouched — verified by simulating the container's envsubst invocation).Relationship to other branches
fix/security-headerswas checked first: its nginx changes are already content-identical to master, so no conflict.Files changed
nginx.conf.template(+9 lines)Tests/checks run
envsubststep over the template: map directives and variables survive verbatim; rendered location block is correct.nginx -t/ deployed verification not run locally (no nginx binary; docker build left to CI). CI's image build covers template inclusion.Risk
X-Forwarded-Proto, the fallback is$scheme(http behind the ingress) — same as today's Jupyter locations.X-Forwarded-Protopasses through when the ingress does not strip/set it; trusting the ingress is the design intent here.Verification after deploy (from the review note)
With the image deployed, the backend log or a debug endpoint should show
request.getRequestURL()starting withhttps://<portal>/services/.