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
FastCGI redirect loop with uWSGI since 6.1 #71
Comments
Did some research: This happens, because PATH_INFO is "" when an application mounted at the root path of a domain is requested. In that case, it should probably be set to "/", otherwise Flask/Werkzeug will respond with an HTTP 301 to /. Because PATH_INFO is still passed as "" after the redirect, although "/" was requested, an endless redirect loop occurs. I am unsure, if this is an httpd or Werkzeug error. |
This fixes Werkzeug-based and possibly other applications using PATH_INFO. CGI RFC3875[1] and PEP3333 state that PATH_INFO can be empty ("") or "/" for application root paths, but some applications (Werkzeug/Flask) except it to be "/". This diff ensures that. Followup discussions: reyk#71 pallets/werkzeug#1240 [1]: https://tools.ietf.org/html/rfc3875#section-4.1.5 [2]: https://www.python.org/dev/peps/pep-3333/#environ-variables
Faced same problem with httpd--fastcgi--uwsgi(flask). Django survives it somehow, but not Flask. Since browser explictily sends "/", should not httpd(8) set PATH_INFO="/" for fastcgi? |
I would opt for the first option as it seems to fix many problems and not cause any. But that's just me. I tried convincing many of the parties involved (Flask/Werkzeug, httpd), but unfortunately interest is limited. For now, I just keep my local installation patched. |
hello, thanks alot! i had the exact same problem, app.url_map.strict_slashes = False solved |
We were experiencing this issue: reyk/httpd#71 and now we are not.
Thanks in advance for opening this issue and providing solution for Flask |
Hey,
I just upgraded my system to OpenBSD 6.1 and have been running into problems with my Flask application deployed via uWSGI and FastCGI sockets.
Whenever I try to request the application I end up with a recursive redirect loop:
As you can see I request the root path and get redirected to it. If I run uWSGI in HTTP mode without httpd in between, this does not happen, so I'm assuming it's not a webapp or uWSGI problem. Additionally, this worked
fine in 6.0.
Has something changed in the way paths are passed to FastCGI changed between 6.0 and 6.1?
The text was updated successfully, but these errors were encountered: