There's an esoteric title. Having not found anything straightforward during many plaintive querying pleas, thought I'd mention how I did it.
First, the topography I wanted was a single apache server fronting multiple CouchDB instances. CouchDB is kinda/sorta a web server as well so you really don't want to bind it to port 80. Rather you want apache on port 80 doing its thing and then a CouchDB instance each using its own port for each namespace you want to manage. This namespace becomes the pivot point for the reverse proxy.
First you will want to load the apache reverse proxy modules. I found the best help on that subject here.
Next, the actual reverse proxy entries. Here the key is CouchDB uses a URL based naming scheme starting with the database name. If you create a database called 'company', then you will access it with 'http://localhost:5984/company'.
Note that port 5984 is the 'default' port CouchDB uses.Back to the original question-- why do I need an apache reverse proxy with my CouchDB? Because I want apache to handle familiar port 80 url requests and use Javascript to communicate with the CouchDB instances on the same machine using different ports (each CouchDB instance needs its port). This of course is denied due to cross-site scripting rules.
So using the 'company' example, the solution is to add this to your httpd.conf:
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
<Location /company>
ProxyPass http://localhost:5984/company
ProxyPassReverse http://localhost:5984/company
</Location>
No comments:
Post a Comment