title: Apache proxy/rewrite with basic auth
body: <p>I'm trying to configure and apache server to act as a proxy and having some problems.</p>
  
  <p>What i want is to be able to make a request from my home computer to apache running on a server and have apache forward this request on to a final destination.</p>
  
  <p>The request must look as if it's originated from the server and it must carry the basic authentication header that's passed from my home computer to the apache server.</p>
  
  <p>I've tried using mod_proxy and simply:</p>
  
  <pre><code>ServerName proxy.server.com
  
  ProxyRequests On
  ProxyVia Block
  RewriteEngine on
  
  &lt;Proxy *&gt;
      Order deny,allow
      Allow from all
      SetEnv proxy-chain-auth
      SetEnv proxy-sendcl
  &lt;/Proxy&gt;
  
  ProxyPass / http://api.finaldestination.com/v1/
  ProxyPassReverse / http://api.finaldestination.com/v1/
  </code></pre>
  
  <p>And this is fine except the final destination server is redirecting me (302 responses) so i'm assuming it's picking up the fact that the request url is proxy.server.com instead of api.finaldestination.com.</p>
  
  <p>I also tried a RewriteRule</p>
  
  <pre><code>RewriteRule ^something/(.*)$ http://api.finaldestination.com/v1/something/$1 [P]
  </code></pre>
  
  <p>but now the basic authentication header doesn't get passed and i get a 404 from api.finaldestination.com</p>
  
  <p>i'm clearly missing something obvious here - can anyone help?</p>
  
  <p>i'm using Ubuntu 12.04</p>