On 2018/01/18 08:25, Henrik Friedrichsen wrote: > Hello, > > I am running Flask apps with uWSGI as a middleware, communicating with > httpd via FastCGI sockets. > > Ever since OpenBSD 6.1 I started running into problems with all of my > Flask apps. They would get caught in a redirect loop for root paths > (see [1]). > > I did some debugging, and it seems that Flasks routing engine Werkzeug > has an option called `strict_slashes`[2], which will append a slash > and redirect to directory requests without a trailing slash. > > When the root URL of an app is requested, e.g. "http://foo.bar", > PATH_INFO will be set to an empty string. This causes Werkzeug to > respond with a redirect, but the next request will still come in with > PATH_INFO as "", resulting in a redirect loop. > > Attached diff causes PATH_INFO to be "/" in such a case, effectively > fixing the problem for me. However, I am not well versed with the > httpd code-base. Maybe it should be corrected with a different > approach. Just sending this in to get the ball rolling. > > The CGI RFC[3] states that "/" and "" are valid paths. I would assume > that for applications mounted at root, PATH_INFO should be "/" instead > of "" when requesting the index.
I think it should skip redirecting for "". You can't actually issue an HTTP request for http://example.com (without the trailing slash). 'A PATH_INFO of "/" represents a single void path segment.' I think that is "http://example.com//". afaict httpd is doing the right thing here.
