In my application I am using following rewrite rule:

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

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 http://api.externalserver.com/login

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

5 Answers 5


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

ProxyRemote *

somewhere in your virtualhost configuration.

  • 2
    where do I have to set this?
    – a06e
    Oct 16, 2015 at 17:08
  • where is mod_proxy_http?!
    – Dr.jacky
    Jun 1, 2016 at 12:42
  • @nickgrim , where do we have to set this?? somewhere!! Nov 29, 2017 at 6:01

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

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

cache_peer 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


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/


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



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

You must log in to answer this question.

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