incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dennis Geurts <dennis.geu...@luminis.eu>
Subject Re: reverse proxy discouraged?
Date Fri, 20 Aug 2010 08:09:23 GMT
A possible solution might be as simple as this:

create a virtualhost in apache2 that points to a particular documentRoot:

file: /etc/apache2/sites-available/couchdb.example.com
-start------
<VirtualHost *:80>
   ServerName couchdb.example.com
   ServerAdmin user@example.com

	DirectoryIndex index.html
        DocumentRoot /var/www/couchdb.example.com/htdocs/
	#Options FollowSymLinks
	#AllowOverride None
</VirtualHost>
-end------

sudo a2ensite couchdb.example.com
sudo /etc/init.d/apache2 reload (or the equivalent for your system)

then, in /var/www/couchdb.example.com/htdocs/

create a file called '.htaccess'
with the following content:

-start------
<Files .htaccess>
order allow,deny
deny from all
</Files>


<IfModule mod_rewrite.c>

RewriteEngine on

#the get options
RewriteRule ^db-name(.*)$ http://localhost:5984/db-name$1 [P]

</IfModule>
-end------

'curl http://couchdb.example.com/index.html' will load the document residing at: /var/www/couchdb.example.com/htdocs/index.html
'curl http://couchdb.example.com/db-name' will load the document residing at: http://localhost:5984/db-name
(i.e. access the couchdb database)

make sure you have mod_proxy and mod_rewrite enabled!


hope this helps,

Dennis



On 20 aug 2010, at 08:07, Randall Leeds wrote:

> Ahh. I understand your problem.
> Your html cannot reference :5984, for cross-domain rules (as you
> noted), but instead the path you've forwarded to Couch.
> I'm not an apache wizard. I won't even pretend to try to tell you how.
> But if the example on the wiki and the apache docs is not enough,
> hopefully someone can chime in here or maybe you can find someone on
> IRC if you catch them at the right time.
> 
> Asking in a more apache-specific forum might also yield some help.
> Even if they're not familiar with Couch I assume anyone with
> sufficient knowledge of the apache web server should be able to direct
> you to how to get X-domain between virtual hosts, if indeed it's
> virtual hosts that are the key.
> 
> Good luck, Dan! And please, when you find out what you were missing
> please tell everyone here and update the wiki with any useful info. I
> have a feeling you're not the first nor the last person to try to set
> this up.
> 
> Cheers,
> Randall


Mime
View raw message