Wednesday, October 31, 2012

Apache: Origin is not allowed by Access-Control-Allow-Origin.


Enable in the httpd.conf file:

LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so

In the ./extra/httpd-proxy.conf file set:

ProxyRequests Off
ProxyPreserveHost On

<Proxy *>
    Order deny,allow
    Allow from all
</Proxy>

Also add  the url you want ie, for /document:

ProxyPass /document http://192.168.2.12:8080/document
ProxyPassReverse /document http://192.168.2.12:8080/document
<Location /document>
    Order allow,deny
    Allow from all
</Location>


Finally restart apache

Resource:
http://stackoverflow.com/questions/7807600/apache-mod-proxy-configuring-proxypass-proxypassreverse-for-cross-domain-ajax

No comments: