The Abstract Truth

How to setup a vhost for a CouchDB couchapp

Posted by rbpasker on February 13, 2013

This is a tutorial for people who already know CouchDB and have their couchapps inside the database.

without vhosts, you reference your apps via this URL scheme:

https://myaccount.cloudant.com/mydatabase/_design/app/index.html

If you want the app to show up like this:

https://www.mysite.com/index.html

here are the instructions (specific to Cloudant.com):

1. create a CNAME on your DNS server:

www.mysite.com.        CNAME  myaccount.cloudant.com.

2. map the CNAME to your app’s design design document’s rewrite rules

visit:
https://cloudant.com/dashboard/#!/dashboard/vhosts

and create an entry that looks like this:

www.mysite.com -> myaccount.cloudant.com /mydatabase/_design/app/_rewrite

3. create rewrite rules that look like this:

[
    {"from": "/","to": "/index.html"},
    {"from": "/*","to": "/*" }
]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: