title: Setting up Apache to use an internal Proxy Server( Proxy Chaining? )
body: <p>I have a situation where I need to route requests to Apache through an internal Proxy Server before redirecting to an external Site, the setup is something like this:</p>
  
  <pre><code>Browser Request --&gt; Apache --&gt; Internal Proxy Server --&gt; External Site
  </code></pre>
  
  <p>Without the Proxy Server I accomplished the redirect using a rewrite handled as a Proxy( [P] )</p>
  
  <pre><code>RewriteRule ^/somepath/(.*) http://www.externalsite.com/$1 [P,QSA,L]
  </code></pre>
  
  <p>I found <a href="https://stackoverflow.com/questions/7554225/setting-up-apache-behind-a-forward-proxy">setting up apache behind a forward proxy</a> which looked like it was what I wanted to setup, and suggested I try the following directives:</p>
  
  <pre><code>ProxyPass /somepath/ http://www.externalsite.com/
  ProxyPassReverse /somepath/ http://www.externalsite.com/
  ProxyRemote  http://www.externalsite.com/ http://internal.proxy.ip.addy:8080
  </code></pre>
  
  <p>When I set this up I got a 503 and the following Apache log entries:</p>
  
  <pre><code>[Thu Apr 11 07:47:14 2013] [debug] mod_proxy_http.c(1973): proxy: HTTP: serving URL http://www.externalsite.com/somefile.html
  [Thu Apr 11 07:47:14 2013] [debug] proxy_util.c(2011): proxy: HTTP: has acquired connection for (www.externalsite.com)
  [Thu Apr 11 07:47:14 2013] [debug] proxy_util.c(2067): proxy: connecting http://www.externalsite.com/somefile.html to www.externalsite.com:80
  [Thu Apr 11 07:47:14 2013] [debug] proxy_util.c(2193): proxy: connected http://www.externalsite.com/somefile.html to internal.proxy.ip.addy:8080
  [Thu Apr 11 07:47:14 2013] [debug] proxy_util.c(2444): proxy: HTTP: fam 2 socket created to connect to www.externalsite.com
  [Thu Apr 11 07:47:35 2013] [error] (OS 10060)A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.  : proxy: HTTP: attempt to connect to internal.proxy.ip.addy:8080 (www.externalsite.com) failed
  </code></pre>
  
  <p>Nothing was logged in the proxy server logs, and I know the proxy server works if I set it explicitly in the browser and load that externalsite.com </p>
  
  <p>Any thoughts?</p>