[Bug 61202] New: SCRIPT_NAME is broken in 2.4.26, path is stripped

classic Classic list List threaded Threaded
17 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Bug 61202] New: SCRIPT_NAME is broken in 2.4.26, path is stripped

Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=61202

            Bug ID: 61202
           Summary: SCRIPT_NAME is broken in 2.4.26, path is stripped
           Product: Apache httpd-2
           Version: 2.5-HEAD
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: major
          Priority: P2
         Component: mod_proxy_fcgi
          Assignee: [hidden email]
          Reporter: [hidden email]
  Target Milestone: ---

Hi,


with 2.4.26 the variable SCRIPT_NAME, which is passed to fcgi applications such
as php-fpm, no longer contains the full uri path.

ex.
http://server.example/~phil/blah.php

$_SERVER['SCRIPT_NAME'] /blah.php
$_SERVER['REQUEST_URI'] /~phil/blah.php
$_SERVER['SCRIPT_FILENAME'] /home/phil/.public_html/blah.php
$_SERVER['CONTEXT_DOCUMENT_ROOT'] /home/phil/.public_html
$_SERVER['CONTEXT_PREFIX'] /~phil

SCRIPT_NAME should be /~phil/blah.php, not /blah.php.


Kind regards

Phil

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Bug 61202] SCRIPT_NAME is broken in 2.4.26, path is stripped

Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=61202

--- Comment #1 from [hidden email] ---
SCRIPT_NAME is set to the correct value when using ProxyFCGIBackendType
GENERIC:

$_SERVER['SCRIPT_NAME'] /~phil/blah.php
$_SERVER['REQUEST_URI'] /~phil/blah.php
$_SERVER['SCRIPT_FILENAME'] /home/phil/.public_html/blah.php
$_SERVER['CONTEXT_DOCUMENT_ROOT'] /home/phil/.public_html
$_SERVER['CONTEXT_PREFIX'] /~phil

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Bug 61202] SCRIPT_NAME is broken in 2.4.26, path is stripped

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=61202

Dave <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[hidden email]

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Bug 61202] SCRIPT_NAME is broken in 2.4.26, path is stripped

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=61202

--- Comment #2 from Dave <[hidden email]> ---
The GENERIC/FPM code path change in mod_proxy_fcgi.c looks very wrong,
particularly the "TODO" part responsible for stripping off leading directory
components (390:392) and appending PATH_INFO to SCRIPT_NAME (RFC3875 says no):

    379     if (fpm || apr_table_get(r->notes, "virtual_script")) {
    380         /*
    381          * Adjust SCRIPT_NAME, PATH_INFO and PATH_TRANSLATED for
PHP-FPM
    382          * TODO: Right now, PATH_INFO and PATH_TRANSLATED look OK...
    383          */
    384         const char *pend;
    385         const char *script_name = apr_table_get(r->subprocess_env,
"SCRIPT_NAME");
    386         pend = script_name + strlen(script_name);
    387         if (r->path_info && *r->path_info) {
    388             pend = script_name + ap_find_path_info(script_name,
r->path_info) - 1;
    389         }
    390         while (pend != script_name && *pend != '/') {
    391             pend--;
    392         }
    393         apr_table_setn(r->subprocess_env, "SCRIPT_NAME", pend);
    394         ap_log_rerror(APLOG_MARK, APLOG_TRACE4, 0, r,
    395                       "fpm:virtual_script: Modified SCRIPT_NAME to:
%s",
    396                       pend);
    397     }

Other than rolling back the whole module to 2.6.25, it does indeed look like
setting ProxyFCGIBackendType to GENERIC (which appears to work fine with FPM
for me, too) is the solution.

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Bug 61202] SCRIPT_NAME is broken in 2.4.26, path is stripped

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=61202

--- Comment #3 from Jacob Champion <[hidden email]> ---
Thanks for the report. We're currently discussing the right fix; as many of you
have already discovered, using a GENERIC backend type will revert to the 2.4.25
behavior. If you're a 2.4.26 user, you probably should not expect the current
behavior of the FPM BackendType (nor its current status as the "default"
setting) to remain as-is.

Note that the 2.4.25 behavior won't work for everyone either. My eventual goal
is to return us (by default) to the 2.4.20 behavior that seemed to work for
many PHP-FPM users, and letting users of other "incompatible" (i.e. correct)
FCGI daemons use the new ProxyFCGISetEnvIf directive if they need it. Sorry for
introducing this mess with my fix to bug 59618.

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Bug 61202] SCRIPT_NAME is broken in 2.4.26, path is stripped

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=61202

--- Comment #4 from Eric Covener <[hidden email]> ---
(In reply to aidbmfqognnq6gizaigaqaaaaaaaa from comment #0)
> Hi,
>
>
> with 2.4.26 the variable SCRIPT_NAME, which is passed to fcgi applications
> such as php-fpm, no longer contains the full uri path.

Hi Phil, I also agree it looks pretty bogus. Out of curiosity, what kind of
config do you use to map these requests to proxy_fcgi?

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Bug 61202] SCRIPT_NAME is broken in 2.4.26, path is stripped

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=61202

--- Comment #5 from Tomas Merta <[hidden email]> ---
Same bug after upgrade:

Config for backend:

<FilesMatch \.php$>
   SetHandler "proxy:unix:/var/run/php-fpm/vu008621.sock|fcgi://vu008621"
</FilesMatch>
<Proxy fcgi://vu008621 disablereuse=On>
</Proxy>

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Bug 61202] SCRIPT_NAME is broken in 2.4.26, path is stripped

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=61202

--- Comment #6 from Eric Covener <[hidden email]> ---
(In reply to Tomas Merta from comment #5)
> Same bug after upgrade:
>
> Config for backend:
>
> <FilesMatch \.php$>
>    SetHandler "proxy:unix:/var/run/php-fpm/vu008621.sock|fcgi://vu008621"
> </FilesMatch>
> <Proxy fcgi://vu008621 disablereuse=On>
> </Proxy>

Please open a new bug report. This PR is about a regression.

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Bug 61202] SCRIPT_NAME is broken in 2.4.26, path is stripped

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=61202

Thomas Stein <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[hidden email]

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Bug 61202] SCRIPT_NAME is broken in 2.4.26, path is stripped

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=61202

--- Comment #7 from Eric Covener <[hidden email]> ---
(In reply to Eric Covener from comment #6)

> (In reply to Tomas Merta from comment #5)
> > Same bug after upgrade:
> >
> > Config for backend:
> >
> > <FilesMatch \.php$>
> >    SetHandler "proxy:unix:/var/run/php-fpm/vu008621.sock|fcgi://vu008621"
> > </FilesMatch>
> > <Proxy fcgi://vu008621 disablereuse=On>
> > </Proxy>
>
> Please open a new bug report. This PR is about a regression.

Sorry, I understand what you wrote now. Thanks for sharing your affected
config.

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Bug 61202] SCRIPT_NAME is broken in 2.4.26, path is stripped

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=61202

--- Comment #8 from [hidden email] ---
Hi Eric,


(In reply to Eric Covener from comment #4)
> Hi Phil, I also agree it looks pretty bogus. Out of curiosity, what kind of
> config do you use to map these requests to proxy_fcgi?

I guess it's a very common config:

<IfModule proxy_fcgi_module>
    ProxyFCGIBackendType GENERIC
    <FilesMatch \.php$>
        SetHandler "proxy:unix:/run/php-fpm/www.sock|fcgi://fpm-www"
    </FilesMatch>
</IfModule>

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Bug 61202] SCRIPT_NAME is broken in 2.4.26, path is stripped

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=61202

Jacob P <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[hidden email]

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Bug 61202] SCRIPT_NAME is broken in 2.4.26, path is stripped

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=61202

--- Comment #9 from Jacob Champion <[hidden email]> ---
*** Bug 61211 has been marked as a duplicate of this bug. ***

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Bug 61202] SCRIPT_NAME is broken in 2.4.26, path is stripped

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=61202

[hidden email] changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[hidden email]

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Bug 61202] SCRIPT_NAME is broken in 2.4.26, path is stripped

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=61202

Jacob Champion <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |FixedInTrunk

--- Comment #10 from Jacob Champion <[hidden email]> ---
Checked into trunk as r1800306 and proposed for backport to 2.4.x.

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Bug 61202] SCRIPT_NAME is broken in 2.4.26, path is stripped

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=61202

Jocelyn <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[hidden email]

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Bug 61202] SCRIPT_NAME is broken in 2.4.26, path is stripped

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=61202

Yann Ylavic <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #11 from Yann Ylavic <[hidden email]> ---
Backported to 2.4.27 with r1800618.

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Loading...