Return-Path: Delivered-To: apmail-couchdb-dev-archive@www.apache.org Received: (qmail 52624 invoked from network); 4 Jul 2009 22:17:05 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 4 Jul 2009 22:17:05 -0000 Received: (qmail 8515 invoked by uid 500); 4 Jul 2009 22:17:15 -0000 Delivered-To: apmail-couchdb-dev-archive@couchdb.apache.org Received: (qmail 8431 invoked by uid 500); 4 Jul 2009 22:17:15 -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 8421 invoked by uid 99); 4 Jul 2009 22:17:15 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 04 Jul 2009 22:17:15 +0000 X-ASF-Spam-Status: No, hits=1.5 required=10.0 tests=NORMAL_HTTP_TO_IP,SPF_PASS,WEIRD_PORT X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of jchris@gmail.com designates 209.85.212.200 as permitted sender) Received: from [209.85.212.200] (HELO mail-vw0-f200.google.com) (209.85.212.200) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 04 Jul 2009 22:17:03 +0000 Received: by vwj38 with SMTP id 38so2347197vwj.13 for ; Sat, 04 Jul 2009 15:16:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:to :content-type:content-transfer-encoding; bh=0LWI1MKRopfvtIa0f7gZHDbip+XOebSDSTI7EdwW62M=; b=Z0YGYNv3G6cOIMlkYSG4dVq0X81i7cwSx0i0bi9lWs9wjk+iZWUPDKWyagSuPdb/0/ S2cXaSzIzo+TiAXqZ9rHt4IvIVgV5EP37eSpyf1CFN7G2eByqXBtXoXi+u3z/QgPnDx1 +qWh/iXW7uTiXLJuiIb/udvlt9xOJcyqvS2Is= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type :content-transfer-encoding; b=RcrBVxWiSYkVUalm6JTni7fRH9JTQn/TVwV7Otxfx9e2lDB/KaHnBnsE+/iGp0Donw WQqlNrN01ddJ4uyQj6+6ZejpyH6E8ytmTC9ev4Tv4BAzOfzG6wmybXJjQLN8iRv68Xri B6nDGw5a0FVtjc7BK9R4rSJ8TdAoOPL3WZ0lE= MIME-Version: 1.0 Sender: jchris@gmail.com Received: by 10.220.76.68 with SMTP id b4mr6136068vck.26.1246745802440; Sat, 04 Jul 2009 15:16:42 -0700 (PDT) In-Reply-To: References: <879778450905061254s7bd5365etf82d85126471a24@mail.gmail.com> <879778450905071033n33151a5cs439e7912c9e21fbd@mail.gmail.com> <6EA12004-CCBE-47F2-BE78-4C3D6F72FD2F@jasondavies.com> <21614A96-E6D2-45A3-BF7F-9D1379D84782@jasondavies.com> <528EC433-F1B6-4F05-8B11-74A1FC7272F7@jasondavies.com> <20090704220857.GF17906@tumbolia.org> Date: Sat, 4 Jul 2009 15:16:42 -0700 X-Google-Sender-Auth: 763c40ab7fbd4a13 Message-ID: Subject: Re: Rewriting URLs From: Chris Anderson To: dev@couchdb.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org On Sat, Jul 4, 2009 at 3:12 PM, Paul Davis wro= te: > On Sat, Jul 4, 2009 at 6:08 PM, Noah Slater wrote: >> Hey Jason, >> >> On Sat, Jul 04, 2009 at 10:34:27PM +0100, Jason Davies wrote: >>> The basic idea is you add a "rewrites": [...] member to your design doc= . >>> This will allow rewriting of any URLs with the prefix mydb/ >>> _design/app/_rewrite. =A0The "rewrites" member is a list of rewrite rul= es >>> of the form {match: ["foo/bar/"], rewrite:["_view/myview", >>> {startkey: [""], endkey: ["", {}]}] >> >> This is great! >> >> Don't let me contribute stop-energy, but I am thinking that if we're goi= ng to do >> this, we might want to go the full way an implement this from the root U= RI of >> the whole CouchDB server instead. >> >> Best, >> >> -- >> Noah Slater, http://tumbolia.org/nslater >> > > We've discussed where to push the URL rewriting previously. The > biggest argument against a DB wide rewrite scheme is that _design/ > documents could end up stomping on each other pretty easily. > > For reference in case other people are confused, the rewrite > capabilities would be best used by putting a proxy in front of CouchDB > that would rewrite all urls to the appropiate CouchDB path. > > Something like: > > Rewrite http://blog.mydomain.com/ to > http://127.0.0.1:5984/my_blog_db/_design/sofar/_rewrite/ > Eventually this could be implemented in CouchDB itself, with a table to lookup app-rewrites for various subdomains or ports. I think it's important to limit what the design doc alone can do. Putting something like a dictionary of app -> ddoc rewrites in config seems like the right place to modify CouchDB at such a fundamental level. Chris --=20 Chris Anderson http://jchrisa.net http://couch.io