Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification.
The "Virtual_Hosts" page has been changed by JoanTouzet: https://wiki.apache.org/couchdb/Virtual_Hosts?action=diff&rev1=3&rev2=4 <<Include(EditTheWiki)>> - See also the [[http://docs.couchdb.org/en/latest/configuring.html#virtual-hosts|official documentation]] for this topic. + See the [[http://docs.couchdb.org/en/latest/configuring.html#virtual-hosts|official documentation]] for this topic. - CouchDB, since 0.11.0, can map requests to different locations based on the `Host` header. This allows different virtual hosts on the same machine to map to different databases or design documents, etc. The most common use case is to map a virtual host to a [[Rewriting_urls|Rewrite Handler]], to provide full control over the application's URIs. - - To add a virtual host, add a CNAME pointer to the DNS for your domain name. For development and testing, it is sufficient to add an entry in the hosts file (`/etc/hosts` on Unix-like operating systems) pointing to 127.0.0.1. For example: {{{ - # Aliases for CouchDB vhosts, see /etc/couchdb/local.ini - 127.0.0.1 sofa.couchdb - }}} - - Test that this is working: {{{ - $ ping sofa.couchdb - PING sofa.couchdb (127.0.0.1) 56(84) bytes of data. - 64 bytes from localhost.localdomain (127.0.0.1): icmp_req=1 ttl=64 time=0.025 ms - 64 bytes from localhost.localdomain (127.0.0.1): icmp_req=2 ttl=64 time=0.051 ms - ^C - }}} - - Finally, add an entry to your [[Configurationfile_couch.ini|Configuration File]] in the [vhosts] section: {{{ - [vhosts] - sofa.couchdb:5984 = /sofa/_design/sofa/_rewrite - }}} - - If your CouchDB is listening on the default HTTP port, or is sitting behind a proxy, then don't specify a port number in the vhost key. - - With the above setup, a request to `http://sofa.couchdb:5984/sweet-o` will be mapped to `http://127.0.0.1:5984/sofa/_design/sofa/_rewrite/sweet-o`. -