title: Apache reverse proxy: how to redirect relative URLs in external site back to itself?
body: <p>I need to bypass cross-site scripting restrictions in order to show users a map when they click a link from an external site which I have loaded inside an iframe (external.com/onlyforme). I learned that the easiest way to do this is to set up a reverse proxy so that Apache would retrieve external.com/onlyforme when I access local.com/external, and make it so that it appears to be coming from my domain.</p>
  
  <p>This mostly works, but when external.com/onlyforme/index.html tries to access external.com/onlyforme/site_media/script.js, this gets redirected to local.com/site_media/script.js, which is not what I want. Instead, I would like this to be redirected to the correct URL inside external.com/onlyforme, so that the external site works as expected.</p>
  
  <p>How can I do that?</p>
  
  <p>I have this in my httpd.conf, outside any other config statements:</p>
  
  <pre><code>ProxyRequests Off
  ProxyPass /external/ http://www.external.com/onlyforme
  ProxyPassReverse /external/ http://www.external.com/onlyforme
  </code></pre>
  
  <p>I am running Apache 2.2.</p>