Bug #1383
closedphp-fastcgi scripts which set http headers = response status 404
Description
When a php script is run using fastcgi and mod_proxy_core which sets the content-type header to say "image/jpeg" or "text/css" the response header generated by lighttpd-1.5.0-r1992 is always status 404. For example:
header("content-type: text/css");
echo("body {}");
exit();
?>
response.c.226: (trace) -- splitting Request-URI
response.c.227: (trace) Request-URI : /Ads/adlog.php?bannerid=166&campaignid=53&zoneid=1&source=&block=0&capping=0&session_capping=0&cb=9b73032dfc
response.c.228: (trace) URI-scheme : http
response.c.229: (trace) URI-authority: www.example.com
response.c.230: (trace) URI-path : /Ads/adlog.php
response.c.231: (trace) URI-query : bannerid=166&campaignid=53&zoneid=1&source=&block=0&capping=0&session_capping=0&cb=9b73032dfc
response.c.285: (trace) -- sanitizing URI
response.c.286: (trace) URI-path : /Ads/adlog.php
mod_access.c.138: (trace) -- handling file in mod_access
response.c.402: (trace) -- before doc_root
response.c.403: (trace) Doc-Root : /var/www/vhosts/default/public/
response.c.404: (trace) Rel-Path : /Ads/adlog.php
response.c.405: (trace) Path : /var/www/vhosts/www.example.com/public/forums/css.php
response.c.458: (trace) -- after doc_root
response.c.459: (trace) Doc-Root : /var/www/vhosts/www.example.com/public/
response.c.460: (trace) Rel-Path : /Ads/adlog.php
response.c.461: (trace) Path : /var/www/vhosts/www.example.com/public/Ads/adlog.php
response.c.480: (trace) -- logical > physical handling physical path
response.c.481: (trace) Doc-Root : /var/www/vhosts/www.example.com/public/
response.c.482: (trace) Rel-Path : /Ads/adlog.php
response.c.483: (trace) Path : /var/www/vhosts/www.example.com/public/Ads/adlog.php
response.c.501: (trace) -
response.c.502: (trace) Path : /var/www/vhosts/www.example.com/public/Ads/adlog.php
response.c.510: (trace) -- file found
response.c.511: (trace) Path : /var/www/vhosts/www.example.com/public/Ads/adlog.php
response.c.663: (trace) -- handling subrequest
response.c.664: (trace) Path : /var/www/vhosts/www.example.com/public/Ads/adlog.php
mod_access.c.199: (trace) -- handling file in mod_access
mod_proxy_core.c.2180: (trace) handling it in mod_proxy_core: physical.path=/var/www/vhosts/www.example.com/public/Ads/adlog.php
mod_staticfile.c.327: (trace) -- checking file for static file
response.c.675: (trace) -- subrequest finished
plugin.c.387: (trace) -- plugins_call_...: plugin 'mod_proxy_core' returns 4
plugin.c.387: (trace) -- plugins_call_...: plugin 'mod_proxy_core' returns 4
plugin.c.387: (trace) -- plugins_call_...: plugin 'mod_proxy_core' returns 4
2007-09-23 23:42:08: (response.c.137) Response-Header:
HTTP/1.1 404 Not Found
X-Powered-By: PHP/5.0.4
Pragma: no-cache
Cache-Control: private, max-age=0, no-cache
Date: Mon, 24 Sep 2007 06:42:08 GMT
Set-Cookie: phpAds_id=08c986db5f14f7e23fddd0b01f177d3c; expires=Tue, 23 Sep 2008 06:42:08 GMT; path=/
Content-type: application/x-javascript
Content-Length: 1018
Server: lighttpd/1.5.0
-- cthree
Updated by jrabbit about 17 years ago
I have PHP returning CSS and image types on r2000 through fastcgi and mod_proxy_core - are you sure your configuration is correct and it is actually running the PHP script? It looks like mod_proxy_core isn't finding the PHP page and is passing it to mod_staticfile.
Please post your config, and look at the WikiFormatting link for details on how to retain linefeeds when pasting fixed-format content.
Updated by Anonymous about 17 years ago
It appears to me that if the paths of the document roots on the php server is different than that of the lighttpd server I get a 404. I tried setting _docroot to the path on the php/fastcgi server and setting the docroot= in php.ini on the php/fastcgi to the path of the docroot on the fastcgi/php server but without success. The only workaround was to create a duplicate directory path on the fastcgi/php server using symlinks. When the docroots on both servers match it works fine.
This may be a documentation deficiency or "_docroot" not working correctly. My config is:
$HTTPurl =~ "\.php$" {
proxy-core.balancer = "sqf"
proxy-core.protocol = "fastcgi"
proxy-core.allow-x-sendfile = "enable"
proxy-core.max-pool-size = 25
proxy-core.backends = ( "cichlid:8002", "lingcod:8002", "goby:8002", "halibut:8002" )
}
-- cthree
Updated by Anonymous about 17 years ago
Replying to cthree@s2ki.com:
Oops:
$HTTP["url"] =~ "\.php$" { proxy-core.balancer = "sqf" proxy-core.protocol = "fastcgi" proxy-core.allow-x-sendfile = "enable" proxy-core.max-pool-size = 25 proxy-core.backends = ( "cichlid:8002", "lingcod:8002", "goby:8002", "halibut:8002" ) }
Updated by jrabbit about 17 years ago
You need to use the proxy-core.rewrite-request option to set the docroot as explained in the documentation at http://trac.lighttpd.net/trac/wiki/Docs%3AModProxyCore.
Please close this bug.
Updated by stbuehler almost 17 years ago
- Status changed from New to Fixed
- Resolution set to invalid
Also available in: Atom