-
Notifications
You must be signed in to change notification settings - Fork 31
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 |
I'm trying to resolve an infinite redirect loop for a WordPress install on httpd. The web server is running on localhost behind relayd which terminates the TLS connections. It appears to be the same issue detailed above, however I can't find the equivalent WordPress setting to Flasks' Online people have suggested modifying the WordPress Permalinks settings to eliminate the trailing slash. I tried selecting the first option called 'Plain' which displays links in this format with no trailing slash, but that does not resolve the issue. The only way that I can log into WordPress admin dashboard for now is by adding the following settings to wp-config.php. I can then login to domain.tld/wp-admin/ however the page rendering is barebones text.
If I remove those my browser gives me the infinite redirect loop If I remove relayd from the mix and serve WordPress on straight port 80 via httpd, the web site loads and performs as expected. |
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: