httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tom Evans <tevans...@googlemail.com>
Subject Re: [users@httpd] Proxy Config Issues
Date Mon, 19 Nov 2012 11:42:46 GMT
On Sun, Nov 18, 2012 at 1:44 AM, Chris Arnold
<carnold@electrichendrix.com> wrote:
>> I did read the docs and they were some what helpful but not completely.
>> Hence, my email to the list. What i am trying to understand is the sections
>> and what they mean. For instance, ProxyPass /. Does >this refer to what will
>> be proxied?
>>>Correct which is the whole document root in this case.
>
>>And http://192.168.123.4/somepath where the request is proxied?
>>>Correct.
>
>>So in my instance, i need to proxy /welcome/client-software.html
>> (ProxyPass) to a whole different apache server (http://192.168.123.4)?
>>>Correct and thats what you said you want to do right?
>
>>Or do i have it backwards?
>>
>> I do have this working (not what i wanted but is useable):
>>
>> ProxyPass /    http://welcome.domain.net/
>>
>> ProxyPassReverse /    http://192.168.123.4/
>>
>>
>>>ProxyPassReverse only makes sense in case of reverse proxy for which you
>>> need to set ProxyRequests to off. So are you trying to set proxy or reverse
>>> proxy?
>
> According to the proxy docs, i need a ProxyPass
>
> ProxyPass /path/tofolder.html      http://sub.domain.net/
>
> So i need our clients to be able to get to a page from
> http://sub.domain.net. Which is on 192.168.123.4. When i access this site,
> now i get a 403 Access denied.


ProxyPass is real simple. When a request comes in to this vhost, if
its URL begins with the first argument to ProxyPass, the request is
proxied. Apache takes off the matching part of the URL, and appends
the rest to the second argument to ProxyPass. It then fetches the
content from that URL, and returns it to the client.

So, if you have this:

ProxyPass /dls/ http://sub.domain.net/

and the URL /dls/12345/the-file.zip is requested

then Apache will work out to fetch http://sub.domain.net/12345/the-file.zip

Your problem, I think, is that you are specifying the public name of
the website in argument 2 of ProxyPass. This is wrong, it should be
the internal name of the backend you want to proxy to - eg
192.168.1.202 (or whatever). If sub.domain.net resolves to
192.168.1.202, then that would be ok, but that would be a strange
configuration.

If sub.domain.net resolves to your public IP, then that is dead wrong
to go in ProxyPass.

ProxyPassReverse deals with fixing response headers that your backend
generates. Eg, in our example, if the backend generates a redirect, it
would have the wrong Location header - it would say
"http://192.168.1.202/12345/the-file.zip" instead of
"http://sub.domain.net/dls/12345/the-file.zip". So you need to tell it
to replace "http://192.168.1.202/" with "http://sub.domain.net/dls/".

Apache can figure out its hostname and protocol fine, so that boils down to:

ProxyPassReverse /dls/ http://192.168.1.202/

Note that if your backend instead returned a Location header like
"http://the-backend/12345/the-file.zip", then that would not get
rewritten. You need to tell httpd all the possible host permutations
that your backend will generate.

Cheers

Tom

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message