[ale] apache2 Proxypass

David Tomaschik ozone at webgroup.org
Tue Jul 17 13:20:18 EDT 2007


Jay Loden wrote:
> Chris Woodfield wrote:
>   
>> Hi all...pardon my lack of apache-fu...
>>
>> I've set up some ProxyPass directives on my apache2 server to  
>> redirect a URL on my public webserver to the (hacked) web interface  
>> on my tivo box behind it on the NAT network. So far everything seems  
>> to work, almost...
>>
>> The remaining niggling issue is that in order for the proxy  
>> passthrough to be successful, I have to remember the trailing slash  
>> on the URL. So far I haven't figured out how to get around that at  
>> all, either. When I enter "http://www.semihuman.com/tivo/" into the  
>> URL from the outside, I get the tivo web interface. When I enter  
>> "http://www.semihuman.com/tivo", I get a 404.
>>
>> Below is the content of the directives (which sits in a site file  
>> under /etc/apache2/sites-available):
>>
>> <Proxy *>
>> Order deny,allow
>> Allow from all
>> </Proxy>
>>
>> ProxyRequests           Off
>> ProxyPass               /tivo/  http://tivo1.semihuman.com/
>> ProxyHTMLURLMap         http://tivo1.semihuman.com      /tivo
>>
>> <Location /tivo/>
>>          ProxyPassReverse        /
>>          SetOutputFilter         proxy-html
>>          ProxyHTMLURLMap         /       /tivo/
>>          ProxyHTMLURLMap         /tivo   /tivo
>>          RequestHeader           unset   Accept-Encoding
>> </Location>
>>
>> Now, I've tried changing the ProxyPass line from /tivo/ to /tivo, but  
>> when I do that the URL without the slash comes up but none of the  
>> links work (they map to http://www.semihuman.com/<file>, not http:// 
>> www.semihuman.com/tivo/<file>) Everything still works properly when I  
>> add the slash to the URL.
>>
>> Any ideas of how to make this work?
>>     
>
> Have you tried setting a redirect for /tivo to /tivo/ with the .htaccess in the document root? 
> http://httpd.apache.org/docs/1.3/misc/howto.html
> You could just redirect /tivo to /tivo/ using the .htaccess I'd think. 
>
> Interestingly, my Apache server(s) redirect from /dirname to /dirname/ anyway, but that might only work if the dirname is an existing directory on disk, not sure. I'm not familiar with the mod_proxy_html syntax, but this seems odd to me: 
>
>   
>>          ProxyHTMLURLMap         /       /tivo/
>>          ProxyHTMLURLMap         /tivo   /tivo
>>     
>
> Might that work if you just changed that second line to read
>
>           ProxyHTMLURLMap         /tivo   /tivo/
>
> -Jay
>   
Apache only fixes the trailing slash for real directories.  I built a 
website using virtual URLs (i.e., encoding dynamic data in the url and 
pulling it out with mod_rewrite) and this posed a problem when it also 
added file extensions without being asked to.  :)

David



More information about the Ale mailing list