-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Redirect loop when PATH_INFO is "" #1240
Comments
As a workaround, you can disable If you want to help out with this, figuring out what the relevant specs are and what they say about |
I did look at the specs but I am unsure what to make of them, which is why I opened this issue. Otherwise I'd gladly have submitted a pull request ;) Here is what the CGI RFC has to say about
Doesn't seem clear to me if |
The WSGI PEP 3333 states the following:
So it probably should not redirect in this case. |
It's saying that it may be, not must be. |
Correct, I never stated otherwise. The OpenBSD webserver is correctly setting (unless I am misinterpreting PEP3333 and the CGI RFC) |
The solution here is to turn off strict slashes for that route then. I don't want to add special cases for specific servers or urls. |
The (imo) better solution would be to have |
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
Cross-Referencing this, as I'm unsure if this needs to be fixed in Werkzeug or httpd:
reyk/httpd#71
TL;DR: OpenBSD httpd sets PATH_INFO to "" when the root URL (GET /) of an application mounted at root is requested. Flask/Werkzeug responds with a 301 redirect to "/". After the redirect, PATH_INFO is still "". This results in a redirect loop.
Which part is the culprit here? Werkzeug's automatic redirect or OpenBSD's PATH_INFO set to ""?
The text was updated successfully, but these errors were encountered: