title: apache mod_proxy, configuring ProxyPass & ProxyPassReverse for cross-domain ajax calls
body: <p>I'm creating an html5 - JavaScript app (for mobile devices, using PhoneGap). I have to interact with a REST service.</p>
  
  <p>The service is now running on <code>"http://localhost:8080/backend/mvc/"</code></p>
  
  <p>I'm developing my app on an wamp server (apache2) (<code>http://localhost/stage/</code>)
  I'm using Chrome for browser.</p>
  
  <p>when preforming an ajax call the browser responds: <code>XMLHttpRequest cannot load http://localhost:8080/backend/mvc/event. Origin http://localhost is not allowed by Access-Control-Allow-Origin.</code></p>
  
  <p>So I find several ways to circumvent this cross-domain ajax call problem:</p>
  
  <p>1) starting chrome <code>chrome.exe --disable-web-security</code>
   => no difference</p>
  
  <p>2) configuring apache using mod_proxy to redirect the traffic.</p>
  
  <p>I enabled in the httpd.conf: </p>
  
  <pre><code>proxy_module
  proxy_connect_module
  proxy_http_module
  </code></pre>
  
  <p>I put a <code>.htaccess</code> file in the www root with the following content:</p>
  
  <pre><code># start mod_rewrite
  RewriteEngine On
  
  ProxyRequests off
  &lt;Proxy&gt;
      Order deny,allow
      Allow from all
  &lt;/Proxy&gt;
  
  ProxyPass /EMBackend/ http://localhost:8080/backend/mvc/
  ProxyPassReverse /EMBackend/ http://localhost:8080/backend/mvc/
  RewriteRule ^/EMBackend/(.*)$ /backend/mvc/$1 [R]
  </code></pre>
  
  <p>I restarted all services (apache,php,..)</p>
  
  <p>resulting in error 500</p>
  
  <p>apache error log: <code>[Tue Oct 18 14:30:11 2011] [alert] [client 127.0.0.1] C:/wamp/www/.htaccess: ProxyRequests not allowed here</code></p>
  
  <p>Any clues on how to resolve this?</p>