Configuring Apache web server to use the http_proxy environment variable

apache-2.2http-proxy

I'm running Red Hat Enterprise Linux 6 with Apache 2.2. How do I configure Apache to use the system HTTP proxy (internal company proxy)? I keep getting 'Connection refused' errors when trying to reverse proxy to external addresses (outside the company firewall).

So far I've tried the following:

Add the below to the httpd.conf file (with the actual credentials and proxy server details):

SetEnv http_proxy http://username:password@proxy:port

I've tried adding the below to /etc/profile, /root/.bash_profile, /root/.profile, /var/www/.profile and /var/www/.bash_profile:

http_proxy http://username:password@proxy:port
export http_proxy

I've also verified that the http_proxy values are correct by performing a

wget www.google.com

from the root shell.

I should add that my ultimate goal is to reverse proxy all local /utag/* URL's to http://tags.tiqcdn.com/utag/* via the internal company HTTP proxy.

Best Answer

I do not think this is possible. I think your only bet would be to get a Squid installation working as a transparent proxy and then put Apache to send the requests to that one.

EDIT:

I resolved this using ProxyRemote (with accompanying ProxyPass statements). On Apache 2.2 this doesn't work with username/password without a patch, but I managed to get company proxy access that grants access by IP instead of requiring user credentials. – rudolfv 17 mins ago