Re: Not a Dev question .. but can someone help me
Graham Leggett <[email protected]>
| Newsgroups | gmane.comp.apache.mod-proxy |
|---|---|
| Message-ID | <[email protected]> |
Lancashire, Pete wrote: > What I'm trying to do is have a Apache 1.3.24 (eventually 2.x) server > act only as a proxy. Use v1.3.26 - the proxy you are using has bugs which have been fixed. > http://outside/images -> http://inside/ > and > http://outside/images/ -> http://inside/ > > Work just fine, and thanks to another list on how to get this to > work without a trialing slash. > > but no matter what I do I can not get the correct reverse translation to > work > > http://inside/you-name-it to become http://outside/images/you-name-it Remember that the ProxyPassReverse translation mechanism doesn't try and be clever - it simply does an exact prefix match replacement. Also remember that the translation *only* happens for stuff in the response headers, like redirects. It *does not* translate stuff in the HTML itself, because a) it's too expensive and b) it will probably get it wrong anyway. As a general rule it is best to make sure that the URI you use on the frontend is the same as the URI used on the backend. ie, if it's http://outside/images/you-name-it on the outside, then it should be http://inside/images/you-name-it on the inside. The reason for this is that if a web designer embeds an URL in a page called /images/blah.gif, it will work on the backend but won't work on the frontend. Usually it's a lot easier to keep the URL spaces the same, rather than trying to change your website to relative links afterwards. > What I have so far in my httpd.conf is: > ------------------------------------------------------------- > RewriteRule ^/images/*(.+) http://inside/$1 [P] > > ProxyPass /images/ <http://inside/> > > ProxyPassReverse /images/ <http://inside/> > ProxyPassReverse /images/ <http://inside.hidden.xyz/> > -------------------------------------------------------------- All you need is: ProxyPass /images/ http://inside/ ProxyPassReverse /images/ http://inside/ A few points to note: - Remember that ProxyPassReverse does an exact copy-replace. If the user tries the URL "http://outside/images" it *won't* match because "/images/" is not a substring of "/images". - Makes sure that "inside" is the correct name for the website. If ProxyPassReverse says look for "http://inside/" but the inside website identifies itself as "http://inside.blah.zxy/" or "http://ip.add.re.ss/, it definitely won't work. Garbage in, garbage out. - You aren't keeping the URL spaces the same. ie, you should rather try this instead: ProxyPass /images/ http://inside/images/ ProxyPass /servlet/ http://inside/servlet/ Regards, Graham -- ----------------------------------------- [email protected] "There's a moon over Bourbon Street tonight..."