6

I have a question to let HTTP Proxy requests via a proxy.

Here is the situation: - I am connected from home to a VPN of my company. - The VPN has a proxy server, which I have configured and it works correctly. I can reach all internal company URL's now.

Now I have the situation that Apache needs to retrieve a URL as well, via that same proxy. And that is where it goes wrong. The request times out. From the browser I can reach that internal URL fine, because the browser is using the proxy for its requests.

So how can I set up Apache to use a proxy?

Please note, I am not asking how to get ProxyPass working, but I am trying to make this work:

<Location /shared_resources_url/>
  ProxyPass http://www.internalcompanyserver.com/shared_resources_url/
  ProxyPassReverse http://www.internalcompanyserver.com/shared_resources_url/
</Location>

So, Apache needs to reach the internalcompanyserver.com . How do I configure Apache to use the company proxy?

I tried Googling this one of course, but I get a lot of results about ProxyPass, not about actually letting Apache connect through a proxy first.

I hope somebody understands what my question is and can help me out! :)

3 Answers 3

7

It looks like the ProxyRemote setting might do what you desire: http://httpd.apache.org/docs/2.2/mod/mod_proxy.html#proxyremote

1
1

(apache) in your virtualhost you can declare your web proxy :

ProxyRemote http http://xxxxxxx:8080
ProxyRemote https http://xxxxxxx:8080
ProxyRemote ftp http://xxxxxxx:8080

OR

ProxyRemote * http://xxxxxxx:8080

Otherwise, in /etc/sysconfig/httpd, you can add :

export http_proxy="http://xxxxxxx:8080/"
export https_proxy="http://xxxxxxx:8080/"

(but this applies to all virtualhosts...)

-1

The thing is you are expecting wrong. If you want to retrieve a url then it is done via code that runs inside apache. AFAIK, apache is for serving content not retrieving content. Retrieving content is done by either code (like php, java , etc) or tools like wget or curl. Both wget and curl very well support connecting through proxy.

1
  • 1
    I think Apache is really the one who is not routing the request correctly, in fact.. if I want to Proxy a URL with a ProxyPass, it also needs to know of the Connection Proxy, otherwise Apache can't serve the content that needs to be requested via the proxy. So in this case, I think Apache is the application that retrieves the content :)
    – Sander
    May 25, 2012 at 10:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .