Return-Path: Delivered-To: apmail-couchdb-dev-archive@www.apache.org Received: (qmail 663 invoked from network); 18 Feb 2010 23:37:24 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 18 Feb 2010 23:37:24 -0000 Received: (qmail 81610 invoked by uid 500); 18 Feb 2010 23:37:23 -0000 Delivered-To: apmail-couchdb-dev-archive@couchdb.apache.org Received: (qmail 81523 invoked by uid 500); 18 Feb 2010 23:37:23 -0000 Mailing-List: contact dev-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list dev@couchdb.apache.org Received: (qmail 81513 invoked by uid 99); 18 Feb 2010 23:37:23 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 18 Feb 2010 23:37:23 +0000 X-ASF-Spam-Status: No, hits=2.7 required=10.0 tests=SPF_NEUTRAL,WEIRD_PORT X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [80.244.253.218] (HELO mail.g3th.net) (80.244.253.218) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 18 Feb 2010 23:37:11 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.g3th.net (Postfix) with ESMTP id 1AF9E6C9175 for ; Fri, 19 Feb 2010 00:36:51 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mail.g3th.net Received: from unknown by localhost (amavisd-new, unix socket) id OglnHETJcMwX for ; Fri, 19 Feb 2010 00:36:50 +0100 (CET) Received: from [10.0.1.200] (h-74-1-186-35.snfccasy.static.covad.net [74.1.186.35]) (authenticated) by mail.g3th.net (amavisd-milter) (authenticated as web50m1); Fri, 19 Feb 2010 00:36:49 +0100 (CET) (envelope-from ) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Apple Message framework v1077) Subject: Re: Virtual Hosts From: Jan Lehnardt In-Reply-To: Date: Thu, 18 Feb 2010 15:36:47 -0800 Content-Transfer-Encoding: quoted-printable Message-Id: <163C2EAC-3A02-4C86-A2F8-8E0224ECE0EB@apache.org> References: <9D2F6BE1-DD90-4702-9196-ED6FBE8B6246@apache.org> To: dev@couchdb.apache.org X-Mailer: Apple Mail (2.1077) X-Virus-Checked: Checked by ClamAV on apache.org On 18 Feb 2010, at 15:30, Noah Slater wrote: > What happens when the Host header is absent? Does it default to the = first one in the file, like Apache httpd? The default case (when there is no Host header (HTTP 1.0) or the host = header doesn't match any vhost) is to act as if the bind-address + port = were called, just like before. Cheers Jan -- >=20 > On 18 Feb 2010, at 23:23, Jan Lehnardt wrote: >=20 >> Hi dev@, >>=20 >> I added virtual host handling to CouchDB. I have a Github branch for = you to check out: >>=20 >> http://github.com/janl/couchdb/commits/vhosts >>=20 >> Alternatively, here's a full diff including etap tests:=20 >>=20 >> http://www.friendpaste.com/6B5dQU1fb27boOvxhm2nhf >>=20 >> =46rom local.ini: >>=20 >> ; To enable Virtual Hosts in CouchDB, add a vhost =3D path directive. = All requests to >> ; the Virual Host will be redirected to the path. In the example = below all requests >> ; to http://example.com/ are redirected to /database. >> ; If you run CouchDB on a specific port, include the port number in = the vhost: >> ; example.com:5984 =3D /database >>=20 >> [vhosts] >> ;example.com =3D /database/ >>=20 >> In combination with Benoit's rewriter, this allows you to create = virtual hosts with=20 >> really pretty URLs.=20 >>=20 >> The CouchDB default behaviour isn't changed. CouchDB simply inspects = a >> request's `Host:` header and maps it against any defined virtual = hosts. If a >> match is found, CouchDB will make an internal redirect much like the = rewriter. >>=20 >> I did a stupid A/B test with Apache Bench and couldn't see any = performance >> degradation. Feel free to prove me wrong :) >>=20 >> I'd like to commit this to trunk and also backport to 0.11. What do = you think? >>=20 >> Thanks for you feedback. >>=20 >> Cheers >> Jan >> -- >>=20 >=20