Replace ReverseProxied with werkzeug/middleware/proxy_fix.py #112

Closed
opened 2026-05-12 08:33:12 +00:00 by jgroman · 0 comments
Owner

Copied from https://pagure.io/elections/issue/106 :

This app uses a ReverseProxied wrapper for the WSGI app that attempts to cope with it being reverse-proxied (in testdays/app.py).

werkzeug X-Forwarded-For Proxy Fix seems to be a better implementation of this, which is documented by flask upstream and handles things like there being multiple comma-separated values in the forwarded headers. It handles more headers, and allows specifying how many levels of proxy there are known to be for each header.

In all respects it seems like a superior replacement (which we don't have to maintain), so we should switch to it, I think.

Open questions: which of the headers are proxied for the Fedora deployment, and how many levels of proxying should we configure (assuming we go back to the append setting for haproxy.router.openshift.io/set-forwarded-headers)? And should we make the wrapper setup configurable to allow for other deployments and for easy changes if our proxying setup changes in future?

See https://forge.fedoraproject.org/infra/tickets/issues/12997 for some background here.

Copied from <https://pagure.io/elections/issue/106> : This app uses a ReverseProxied wrapper for the WSGI app that attempts to cope with it being reverse-proxied (in `testdays/app.py`). [werkzeug X-Forwarded-For Proxy Fix](https://werkzeug.palletsprojects.com/en/stable/middleware/proxy_fix/) seems to be a better implementation of this, which is documented [by flask upstream](https://flask.palletsprojects.com/en/stable/deploying/proxy_fix/) and handles things like there being multiple comma-separated values in the forwarded headers. It handles more headers, and allows specifying how many levels of proxy there are known to be for each header. In all respects it seems like a superior replacement (which we don't have to maintain), so we should switch to it, I think. Open questions: which of the headers are proxied for the Fedora deployment, and how many levels of proxying should we configure (assuming we go back to the `append` setting for `haproxy.router.openshift.io/set-forwarded-headers`)? And should we make the wrapper setup configurable to allow for other deployments and for easy changes if our proxying setup changes in future? See <https://forge.fedoraproject.org/infra/tickets/issues/12997> for some background here.
jgroman self-assigned this 2026-06-12 13:28:47 +00:00
jgroman added this to the Sprint 12 project 2026-06-12 13:28:52 +00:00
jgroman removed this from the Sprint 12 project 2026-06-18 11:02:12 +00:00
jgroman added this to the Sprint 11 project 2026-06-18 11:02:18 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
quality/testdays-web#112
No description provided.