Bug #17
closedmod_proxy passes on redirect from site it proxies
Description
I have the following part in my config:
proxy.server = ( "/site" => ( "site" => ( "host" => "127.0.0.1", "port" => 82 ) ) )
It forwards the request to Apache, wich is running on port 82.
If I point my browser to {{{http://localhost/site/}}} is serves me the page generated by Apache. But if I point my browser to {{{http://localhost/site}}}, the URI in the browser gets rewritten to {{{http://localhost:82/site/}}}.
-- Mark van Eijk
Updated by Anonymous almost 20 years ago
Interesting is that if I go to the link without the trailing slash, the following is present in the header:
HTTP/1.0 301 Moved Permanently
In the other case it just proxies.
-- Mark van Eijk
Updated by Anonymous almost 20 years ago
I figured out that the HTTP-status 301 is coming from Apache, since it redirects {{{http://localhost:82/site}}} to {{{http://localhost:82/site/}}}. But since lighttpd passes this redirect along, it actually redirects to {{{http://localhost:82/site/}}} instead of {{{http://localhost/site/}}} like expected when asking for {{{http://localhost/site}}}.
-- Mark van Eijk
Updated by jan almost 20 years ago
- Status changed from New to Fixed
- Resolution set to invalid
As discussed on IRC this is not a bug and should be handled in the backward Webserver.
If this is not possible a rewrite-location setting should be added to the mod_proxy module.
Updated by Anonymous almost 18 years ago
You will be able to fix this problem by looking at the apache directive 'UseCanonicalName' set this to off in any of the virtual hosts where you need to have lighttpd (on port 80) acting as the front end proxy to apache (on port 81 etc). With this directive set to OFF, then apache will pass back to the browser the URL with a port based on info in the browser sent host header. Be aware that the your virtual host tag should not use port info (like <virtualhost *:81> ) because the from my limited testing the UseCanonical will not work properly.
As a note to the Lightty team, this info on how to put lighty in front of apache and the need to use the 'UseCanonical...' directive should be discussed in lighty's manuals. The reason i say such, is because most how-to articles discuss apache in front of lighty. I really wanted to limit apache to only a few apps where it was mandatory and fully gain the performance of using lighty as the front proxy (why put lighty behind a slow apache.). It took me way too long to find this problem the first time of setup, that I had to switch back to apache in front of lighty for the apps where speed was critical (this worked 1st time), it was only after the second attempt that i determined how to get lightty to work with apache. This need for a second attempt scared me a bit from adopting lightty as a full solution :( . Now it works and i am very happpppyyyyyyyy!!
Great work lighty team, this server rocks!
jeremy lightstone // GlobalAdSales.com
-------------------------------------------
CTO & Creative Director
636 Broadway, 3rd Floor, NY, NY. 10012
P: 212.404.5700
E: hidden from spammers
GlobalAdSales.com , http://ActionandSports.com , http://MusicVision.com , http://TechandGamers.com
-- jeremy lightstone // GlobalAdSales.com
Also available in: Atom