-
Notifications
You must be signed in to change notification settings - Fork 212
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
"Fix" for lighttpd in Handler/FCGI.pm breaks Apache+FastCGI #299
Comments
Break how? Provide more details and/or unit test to reproduce the issue. Sent from my iPhone On Wednesday, June 27, 2012 at 2:18 PM, ttulttul wrote:
|
I don't have time to put together a unit test - sorry about that - but here is an example of the breakage. Before this code, PATH_INFO = "/localhost/login", SCRIPT_NAME = "", and REQUEST_URI = "/login". Why throw away the old contents of PATH_INFO and assume that REQUEST_URI will be an appropriate replacement? |
Do you have some own weird mod_rewrite setup? I can't see how you get |
The comment is meant to say that this was originally to fix the issue with lighttpd, but as the commit you pointed out suggests with the github issue, this fix is universal to work with any FastCGI setup. |
That line also breaks IIS+FCGI as displayed in Issue #284 has a working test script of how it breaks IIS. |
Yes, repeating slashes inside its own SCRIPT_NAME might be an issue - but |
"/localhost" is a bad example. In our case, we're using rewrite to insert the "site" name into a multi-tenant web app. The "localhost" might be "site1", "site2" etc.. We really do need the PATH_NAME variable to be left unmolested because it differs from the REQUEST_URI, which mod_rewrite does not modify. |
OK, yes, if you use rewrite to inject some custom variables into PATH_INFO that could be an issue. |
Here is the rewrite code - I don't think it's too unusual. This is just following the Catalyst Apache+FastCGI documentation: RewriteEngine On
RewriteRule ^/?(.*) /usr/local/tcls-ui/script/fastcgi.pl/sitename/$1 [L] |
I'm not sure what the best solution for this is, but here's another vote for either moving the multiple-slash fix into middleware or otherwise providing some way to disable the "fix". Here's my use case, if you're interested: Legacy Mason app, which I've just converted to run under PSGI. This is running as a FastCGI service behind nginx. Anyhow, I do understand how restoring multiple slashes may be important for some apps, but to me, that seems like an edge case. There are legitimate reasons (e.g. apache's mod_rewrite or nginx's rewrite) that PATH_INFO may not be the same as REQUEST_URI. It was a big surprise to me when I figured out that the FSGI handler was totally ignoring the PATH_INFO. |
There is a more serious issue because this fix makes it incompatible with HTTP/1.1 /RFC 2616 (http://www.w3.org/Protocols/rfc2616/rfc2616-sec5.html). In particular:
If the request contains an absolute URI, because of the fix, the $uri variable becomes "http://localhosthttp://example.com/index.html" and the PATH_INFO variable is then set to //example.com/index.html. An easy fix is to test whether REQUEST_URI is an absolute path. |
As with @dairiki and others, this has just bitten me, here are the straightforward relevant lines from the Apache config:
When Apache sends the information to the app, |
I have another case where this code breaks things: |
This code breaks path handling in Apache+FastCGI:
Can someone please make this code execute only when the server really actually is lighttpd?
The text was updated successfully, but these errors were encountered: