-
Notifications
You must be signed in to change notification settings - Fork 0
fix(nginx): use backend hostname in Host header to prevent ALB routing loops #37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,7 +22,9 @@ server { | |
| resolver_timeout 5s; | ||
| set $backend_url ${API_BACKEND_URL}; | ||
| proxy_pass http://$backend_url; | ||
| proxy_set_header Host $host; | ||
| # Use the backend hostname, not the incoming request's Host. | ||
| # Prevents routing loops when an ALB uses Host-based routing. | ||
| proxy_set_header Host $backend_url; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But this will have to be tested in the OP Sandbox, right?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not possible due to limited subnet. Hence https://github.com/meaningfy-ws/entity-resolution-ops/pull/30. |
||
| 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; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The suggestion to use
$proxy_hostwon't work -- it's only populated for static upstreams.