Reverse Proxy in Apache2 (Ubuntu 10.04) for CouchDB

Installing Modules

There are various sites with instructions that did not work.
However, following the instructions here> did the trick.

The reverse proxy module was installed:

sudo apt-get install libapache2-mod-proxy-htm

Libxml was installed:

apt-get install libxml2-dev

Edit apache2.conf

The following was added to the apache2.conf file:

LoadModule proxy_module /usr/lib/apache2/modules/
LoadModule proxy_http_module /usr/lib/apache2/modules/
LoadModule headers_module /usr/lib/apache2/modules/
LoadModule deflate_module /usr/lib/apache2/modules/
LoadFile /usr/lib/

VirtualHost config

Finally, below is the VirtualHost config I personally used based on advice from in order to get CouchDB to work correctly.

<VirtualHost *:80>

ServerAdmin webmaster@localhost

Header set Access-Control-Allow-Origin "*"
Header set Access-Control-Allow-Headers Content-Type
Header set Access-Control-Allow-Methods "GET, PUT, OPTIONS, DELETE, POST"
Header set Access-Control-Max-Age 3600

DocumentRoot /var/www

ProxyPass / http://localhost:5984/ nocanon
ProxyPassReverse / http://localhost:5984/

Options FollowSymLinks
AllowOverride None

Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/

AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all

ErrorLog /var/log/apache2/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog /var/log/apache2/access.log combined

Alias /doc/ "/usr/share/doc/"

Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from ::1/128



Menelaos Bakopoulos

Mr. Menelaos Bakopoulos is currently pursuing his PhD both at Center for TeleInFrastruktur (CTiF) at Aalborg University (AAU) in Denmark and Athens Information Technology (AIT) in Athens, Greece. He received a Master in Information Technology and Telecommunications Systems from Athens Information Technology and a B.Sc. in Computer Science & Management Information Systems from the American College of Thessaloniki. Since April 2008 he has been a member of the Multimedia, Knowledge, and Web Technologies Group.

More Posts