Mihir-Rabari commented on issue #73941:
URL: https://github.com/apache/airflow/issues/73941#issuecomment-6141383862

   I dug into this. It is not LDAP-specific: every POST to the FAB Flask app 
(including the login form) fails because flask-wtf's CSRF referer check 
(WTF_CSRF_SSL_STRICT, default on) compares `https://{request.host}/` against 
the Referer, and with `enable_proxy_fix = True` werkzeug's ProxyFix bakes 
X-Forwarded-Port into the Host. Gateways like Envoy/HTTPRoute send their 
listener port there, not the public port in the browser's URL, so the 
comparison can never succeed. Stripping X-Forwarded-Port (your workaround) or 
`proxy_fix_x_port = 0` sidesteps it; X-Forwarded-Port = 443 with https also 
works (werkzeug strips default ports). The open question is what the default 
should be: werkzeug itself defaults x_port to 0, and a gateway that reports a 
port that is not the public one is arguably misconfigured — but it's a common 
one. Would you prefer (a) defaulting proxy_fix_x_port to 0, (b) documenting 
that X-Forwarded-Port must reflect the public port, or (c) making the referer 
check config
 urable/trusted-origins-style? Happy to PR whichever direction you prefer.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to