Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

In my application I am using following rewrite rule:

RewriteRule ^/ajax(.*) http://api.externalserver.com/$1 [P,QSA,L]

You know what it does.

Now the problem is that my corporate network requires me to use HTTP proxy for external internet connections.

To ilustrate, this doesn't work:

curl -v http://api.externalserver.com/login

But this works:

curl -v -x 11.22.11.22:8585 http://api.externalserver.com/login

How can I make Apache use the corporate proxy for external internet requests?

share|improve this question

5 Answers 5

up vote 6 down vote accepted
+50

I think you'll want to enable mod_proxy_http, and set:

ProxyRemote * http://11.22.11.22:8585

somewhere in your virtualhost configuration.

share|improve this answer

Did you try http tunneling, via proxytunnel or corkscrew ?

You need to configure a vhost for your Apache and use it as a distant proxy.

Maybe adapting this could help you : http://dag.wieers.com/howto/ssh-http-tunneling/

share|improve this answer

I think what you are looking for is mod_proxy, and mod_proxy_http specifically:

http://httpd.apache.org/docs/2.2/mod/mod_proxy_http.html

share|improve this answer

You may install SQUID proxy in transparent mode to proxy all traffic going from local machine to the internet.

For this first add iptables rule

iptables -t nat -A OUTPUT -p tcp --dport 5555 -j DNAT --to 127.0.0.1:3128

this will redirect all outgoing http connections to local squid. Then configure squid according to this guide and additionaly configure

cache_peer 11.22.11.22 parent 8585 0 no-query default
never_direct allow all

That's all. All your outgoing traffic to port 80 will go through your organisation proxy

share|improve this answer

After setting ProxyRemote and restarted httpd, if you got the "[error] (13)Permission denied: proxy: HTTP: attempt to connect to failed", then you also need to execute the following:

setsebool -P httpd_can_network_connect=1
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.