Skip to content

[v3-3-test] Honor FORWARDED_ALLOW_IPS when the API server runs under gunicorn (#71429) - #71708

Merged
potiuk merged 1 commit into
v3-3-testfrom
backport-d4581ae-v3-3-test
Aug 17, 2026
Merged

potiuk merged 1 commit into
v3-3-testfrom
backport-d4581ae-v3-3-test

Conversation

@github-actions

Copy link
Copy Markdown
Contributor
  • 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]

…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
potiuk force-pushed the backport-d4581ae-v3-3-test branch from 110e1cd to 8b4a10f Compare August 17, 2026 17:11

@potiuk potiuk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rebased onto the current v3-3-test tip; replays cleanly and the gunicorn app tests pass locally against this branch.

Scope note for a maintenance branch: this is a security fix rather than a feature — UvicornWorker leaves uvicorn's proxy_headers at its default of True, so turning proxy headers off still trusted X-Forwarded-* from every client until now. Worth flagging that the change also introduces a RemovedInAirflow4Warning that fires whenever FORWARDED_ALLOW_IPS is unset, so deployments that never set it will start seeing a new deprecation warning on this branch.


Drafted-by: Claude Code (Opus 5); reviewed by @potiuk before posting

@potiuk
potiuk merged commit 20c7876 into v3-3-test Aug 17, 2026
138 of 143 checks passed
@potiuk
potiuk deleted the backport-d4581ae-v3-3-test branch August 17, 2026 19:41
@github-actions github-actions Bot added this to the Airflow 3.3.2 milestone Aug 17, 2026
@github-actions

Copy link
Copy Markdown
Contributor Author

Hi maintainer, this PR was merged without a milestone set.
We've automatically set the milestone to Airflow 3.3.2 based on: merged to version branch
If this milestone is not correct, please update it to the appropriate milestone.

This comment was generated by Milestone Tag Assistant.

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]>
@vatsrahul1001 vatsrahul1001 added the type:bug-fix Changelog: Bug Fixes label Sep 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants