Bug #729
Incorrect PATH_INFO when FastCGI is serving "/"
| Status: | Fixed | Start date: | ||
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assignee: | - | % Done: | 0% | |
| Category: | mod_fastcgi | |||
| Target version: | 1.4.23 | |||
| Missing in 1.5.x: |
Description
When mod_fastcgi is serving "/" i.e. configured as following
fastcgi.server = (
"/" => (
...
)
)
it produces wrong SCRIPT_NAME and PATH_INFO.
For example, request for /test/url is represented as
SCRIPT_NAME = "/test" PATH_INFO = "/url"
while it has to be
SCRIPT_NAME = "" PATH_INFO = "/test/url"
Interesting that mod_scgi doesn't have that issue.
Associated revisions
Fix workaround for incorrect path info/scriptname if fastcgi prefix is "/" (fixes #729)
Fix workaround for incorrect path info/scriptname if scgi prefix is "/" (fixes #729)
History
#1 Updated by Anonymous almost 7 years ago
This occurs when mapping any URL ending in "/" to FastCGI. The same mapping with the ending "/" removed works correctly.
-- mgood
#2 Updated by Anonymous almost 7 years ago
This causes problems for trac, when it is sitting in the root directory. See trac bug 2418.
-- teg
#3 Updated by Anonymous over 6 years ago
Any idea why this has not been checked in? It doesn't look hackish, given we also port it to all places using the same code.
#4 Updated by Anonymous over 6 years ago
FWIW, the above patch fixes this bug for mod_scgi as well (in my case, tested with DrProject).
-- shot
#5 Updated by Anonymous about 6 years ago
I've been hit by the same problem when trying to use Moin as the root URI.
There is no straightforward solution to this, as there is no generic pattern for splitting the URI in SCRIPT_NAME and PATH_INFO. In some cases you want the whole URI in PATH_INFO, in some other cases you want SCRIPT_NAME to be set, and you could imagine thousands of other cases.
I'd like this to be fixed by a URI => PATH_INFO mapping, with a new configuration variable. The result could look like this:
fastcgi.path_info = (
"^/(admin|stats)/(.*)" => ("/$1", "/$2"),
"^(.*)$" => ("", "$1"),
)
This way /admin/foo would lead to SCRIPT_NAME="/admin" and PATH_INFO="/foo", while /bar would lead to SCRIPT_NAME="" and PATH_INFO="/bar".
-- joss
#6 Updated by Anonymous almost 6 years ago
The problem is still present on 1.4.16...
-- lindevel
#7 Updated by Anonymous over 5 years ago
And still in 1.4.18, it seems...
-- lindevel
#8 Updated by Anonymous about 5 years ago
This patch works great for me. I couldn't get a Mercurial repository (hgwebdir cgi script) working on my web server without it.
Please include it!
-- schnouki
#9 Updated by moo about 5 years ago
- Status changed from New to Assigned
#10 Updated by moo about 5 years ago
this problem is fixed in 1.5.0, i'm working out a solution to this for 1.4.x
#11 Updated by moo about 5 years ago
- Status changed from Assigned to Fixed
- Resolution set to fixed
fixed in r2182, use "fix-root-scriptname" => "enable" to workaround, untested yet. can u pls test it?
#12 Updated by stbuehler about 4 years ago
- Target version changed from 1.4.20 to 1.4.23
#13 Updated by PaulM about 4 years ago
r2421 fixed the problem for me. Thanks!
Also available in: Atom
