Repository navigation
fix(deploy): pass the front proxy's scheme through the web tier - #77
Merged
Merged
Conversation
nginx set X-Forwarded-Proto to its own scheme, which is always http since it listens without TLS behind a proxy or load balancer. The orchestrator therefore took an HTTPS site to be plain HTTP: OIDC redirect URIs were built as http://, the CSRF check expected the http origin (hence DV_CSRF_TRUSTED_ORIGINS), and the Flower cookie was issued without Secure. nginx now passes on X-Forwarded-Proto: https when the proxy in front sent it, and falls back to its own scheme otherwise. A client that sends the header itself only changes how its own request is seen. The front proxy must send X-Forwarded-Proto: https and pass Host through unchanged; DEPLOYMENT.md says so.
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.
What and why
nginx in the
webimage setX-Forwarded-Prototo its own$scheme. It listens without TLS behind a proxy or load balancer, so that was alwayshttp, and the orchestrator took an HTTPS site to be plain HTTP:http://;httporigin, which is whyDV_CSRF_TRUSTED_ORIGINSwas required;Secure.docker/nginx.conf.templatenow passes onX-Forwarded-Proto: httpswhen the proxy in front sent it and falls back to its own scheme otherwise. One mapped value feeds all three proxied locations (/api, the Flower proxy and the Flower auth check).Things to be aware of:
X-Forwarded-Proto: httpsand passHostthrough unchanged.docs/DEPLOYMENT.md(Users and access) now says so, with the nginx and HAProxy lines.Independent of #75 and #76.
How it was tested
make checkpasses.nginx:1.30-alpinecontainer against an echo upstream:https,HTTPSandhttps, httpcome through ashttps; no header,http,httpsxandftpcome through ashttp.https://.Checklist
make checkpasses locallyDV_*variables are documented indocs/DEPLOYMENT.mdand the relevant*.env.example(none added)makemigrations) (no model changes)api/serializers.py,api/views.pyandfrontend/src/api/types.ts/endpoints.tsin step (no API changes)README.md,docs/) updated where behaviour changed