Repository navigation
Honor FORWARDED_ALLOW_IPS when the API server runs under gunicorn - #71429
Merged
pierrejeambrun merged 4 commits intoAug 17, 2026
Merged
Conversation
Running behind a TLS-terminating proxy is documented as `--proxy-headers` plus `FORWARDED_ALLOW_IPS` to say which proxies may be trusted, and that is what the uvicorn server type does. The gunicorn server type forced the trust list to every address instead, so an operator who narrowed it to their proxy silently got a server that accepted X-Forwarded-* from anyone able to reach it directly -- including the X-Forwarded-Proto that decides whether session cookies are issued with the Secure attribute. Both server types now follow the documented contract. related: apache#47878
rjgoyln
force-pushed
the
proxy-headers-forwarded-allow-ips
branch
from
August 11, 2026 11:56
fa59e9b to
4efba80
Compare
henry3260
reviewed
Aug 11, 2026
rjgoyln
marked this pull request as ready for review
August 11, 2026 13:46
rjgoyln
requested review from
bugraoz93,
choo121600,
ephraimbuddy,
jason810496,
pierrejeambrun,
rawwar and
shubhamraj-git
as code owners
August 11, 2026 13:46
pierrejeambrun
left a comment
Member
There was a problem hiding this comment.
Thanks for the PR just one adjustment to make I believe.
…ng it Deployments whose proxy is not on the API server's host, and which never set FORWARDED_ALLOW_IPS, are relying on gunicorn being handed a trust list of every address. Reading the variable where it is set already gives operators back the control they thought they had; taking the wide default away from everyone else belongs in a major version. The reverse-proxy guide named uvicorn throughout, from when it was the only option.
Contributor
Author
Hi @pierrejeambrun, Thanks for the great suggestions! Really appreciate it.
I also removed the "Behavior change" section from the PR description. |
pierrejeambrun
approved these changes
Aug 17, 2026
Contributor
Backport successfully created: v3-3-testNote: As of Merging PRs targeted for Airflow 3.X In matter of doubt please ask in #release-management Slack channel.
|
aws-airflow-bot
pushed a commit
to aws-mwaa/upstream-to-airflow
that referenced
this pull request
Aug 17, 2026
…gunicorn (apache#71429) * Honor FORWARDED_ALLOW_IPS when the API server runs under gunicorn Running behind a TLS-terminating proxy is documented as `--proxy-headers` plus `FORWARDED_ALLOW_IPS` to say which proxies may be trusted, and that is what the uvicorn server type does. The gunicorn server type forced the trust list to every address instead, so an operator who narrowed it to their proxy silently got a server that accepted X-Forwarded-* from anyone able to reach it directly -- including the X-Forwarded-Proto that decides whether session cookies are issued with the Secure attribute. Both server types now follow the documented contract. related: apache#47878 * Delete airflow-core/newsfragments/71429.significant.rst * Warn about the wide gunicorn proxy-header default instead of tightening it Deployments whose proxy is not on the API server's host, and which never set FORWARDED_ALLOW_IPS, are relying on gunicorn being handed a trust list of every address. Reading the variable where it is set already gives operators back the control they thought they had; taking the wide default away from everyone else belongs in a major version. The reverse-proxy guide named uvicorn throughout, from when it was the only option. * Re-run CI after a transient go-mod-tidy download failure (cherry picked from commit d4581ae) Co-authored-by: rjgoyln <[email protected]>
potiuk
pushed a commit
that referenced
this pull request
Aug 17, 2026
…gunicorn (#71429) * Honor FORWARDED_ALLOW_IPS when the API server runs under gunicorn Running behind a TLS-terminating proxy is documented as `--proxy-headers` plus `FORWARDED_ALLOW_IPS` to say which proxies may be trusted, and that is what the uvicorn server type does. The gunicorn server type forced the trust list to every address instead, so an operator who narrowed it to their proxy silently got a server that accepted X-Forwarded-* from anyone able to reach it directly -- including the X-Forwarded-Proto that decides whether session cookies are issued with the Secure attribute. Both server types now follow the documented contract. related: #47878 * Delete airflow-core/newsfragments/71429.significant.rst * Warn about the wide gunicorn proxy-header default instead of tightening it Deployments whose proxy is not on the API server's host, and which never set FORWARDED_ALLOW_IPS, are relying on gunicorn being handed a trust list of every address. Reading the variable where it is set already gives operators back the control they thought they had; taking the wide default away from everyone else belongs in a major version. The reverse-proxy guide named uvicorn throughout, from when it was the only option. * Re-run CI after a transient go-mod-tidy download failure (cherry picked from commit d4581ae) Co-authored-by: rjgoyln <[email protected]>
potiuk
pushed a commit
that referenced
this pull request
Aug 17, 2026
…gunicorn (#71429) (#71708) * Honor FORWARDED_ALLOW_IPS when the API server runs under gunicorn Running behind a TLS-terminating proxy is documented as `--proxy-headers` plus `FORWARDED_ALLOW_IPS` to say which proxies may be trusted, and that is what the uvicorn server type does. The gunicorn server type forced the trust list to every address instead, so an operator who narrowed it to their proxy silently got a server that accepted X-Forwarded-* from anyone able to reach it directly -- including the X-Forwarded-Proto that decides whether session cookies are issued with the Secure attribute. Both server types now follow the documented contract. related: #47878 * Delete airflow-core/newsfragments/71429.significant.rst * Warn about the wide gunicorn proxy-header default instead of tightening it Deployments whose proxy is not on the API server's host, and which never set FORWARDED_ALLOW_IPS, are relying on gunicorn being handed a trust list of every address. Reading the variable where it is set already gives operators back the control they thought they had; taking the wide default away from everyone else belongs in a major version. The reverse-proxy guide named uvicorn throughout, from when it was the only option. * Re-run CI after a transient go-mod-tidy download failure (cherry picked from commit d4581ae) Co-authored-by: rjgoyln <[email protected]>
vatsrahul1001
pushed a commit
that referenced
this pull request
Sep 7, 2026
…gunicorn (#71429) (#71708) * Honor FORWARDED_ALLOW_IPS when the API server runs under gunicorn Running behind a TLS-terminating proxy is documented as `--proxy-headers` plus `FORWARDED_ALLOW_IPS` to say which proxies may be trusted, and that is what the uvicorn server type does. The gunicorn server type forced the trust list to every address instead, so an operator who narrowed it to their proxy silently got a server that accepted X-Forwarded-* from anyone able to reach it directly -- including the X-Forwarded-Proto that decides whether session cookies are issued with the Secure attribute. Both server types now follow the documented contract. related: #47878 * Delete airflow-core/newsfragments/71429.significant.rst * Warn about the wide gunicorn proxy-header default instead of tightening it Deployments whose proxy is not on the API server's host, and which never set FORWARDED_ALLOW_IPS, are relying on gunicorn being handed a trust list of every address. Reading the variable where it is set already gives operators back the control they thought they had; taking the wide default away from everyone else belongs in a major version. The reverse-proxy guide named uvicorn throughout, from when it was the only option. * Re-run CI after a transient go-mod-tidy download failure (cherry picked from commit d4581ae) Co-authored-by: rjgoyln <[email protected]>
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
Running behind a TLS-terminating proxy is documented as
--proxy-headersplusFORWARDED_ALLOW_IPSto name which proxies may be trusted, andserver_type = uvicornworks that way.server_type = gunicornpinned the trust list to"*", so an operator who narrowed it to their own proxy silently got a server acceptingX-Forwarded-*from anyone able to reach it directly — including theX-Forwarded-Protothat decides whether session cookies carry theSecureattribute. Gunicorn reads the variable natively, so honouring it is a matter of not overriding it.Where it is unset the wide default stays and only warns, since off-host proxies depend on it; tightening waits for Airflow 4. Turning
--proxy-headersoff now trusts nobody, which is what the flag already meant under uvicorn.Note on #47878
The audit there closes with "For uvicorn, ther's no
forwarded_allow_ipswhich is probably a gap". Read the other way round, uvicorn already matchesrun-behind-proxy.rstand the hardcoded"*"is the anomaly. Every cookie site that audit lists now uses the proxy-awaresecure = ...expression, leaving this as the last behavioural item on the issue.related: #47878
Was generative AI tooling used to co-author this PR?
Generated-by: Claude Code (Opus 5) following the guidelines