Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@wu-lee
Created February 28, 2014 16:31
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wu-lee/9274194 to your computer and use it in GitHub Desktop.
Save wu-lee/9274194 to your computer and use it in GitHub Desktop.
Using Apache as s CORS-handling proxy to a CouchDB server
<IfModule !proxy_module>
LoadModule proxy_module /usr/lib/apache2/modules/mod_proxy.so
</IfModule>
<IfModule !proxy_http_module>
LoadModule proxy_http_module /usr/lib/apache2/modules/mod_proxy_http.so
</IfModule>
<IfModule !headers_module>
LoadModule headers_module /usr/lib/apache2/modules/mod_headers.so
</IfModule>
ProxyRequests Off
<Location /inventory/>
RewriteEngine On
RewriteCond %{REQUEST_METHOD} !=OPTIONS
RewriteRule /inventory/(.*) http://localhost:5984/inventory/$1 [P,L]
ProxyPassReverse http://localhost:5984/inventory/
Header set Access-Control-Allow-Origin "*"
#Header set Access-Control-Allow-Headers "Origin, X-Requested-With, Content-Type, Accept"
#Header set Access-Control-Allow-Methods "GET, PUT, POST, OPTIONS, DELETE, HEAD, COPY"
Header set Access-Control-Max-Age 3600
</Location>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment