From user-return-15793-apmail-couchdb-user-archive=couchdb.apache.org@couchdb.apache.org Tue Apr 12 16:44:42 2011 Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 27108 invoked from network); 12 Apr 2011 16:44:42 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 12 Apr 2011 16:44:42 -0000 Received: (qmail 79707 invoked by uid 500); 12 Apr 2011 16:44:40 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 79680 invoked by uid 500); 12 Apr 2011 16:44:40 -0000 Mailing-List: contact user-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@couchdb.apache.org Delivered-To: mailing list user@couchdb.apache.org Received: (qmail 79672 invoked by uid 99); 12 Apr 2011 16:44:40 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 12 Apr 2011 16:44:40 +0000 X-ASF-Spam-Status: No, hits=4.7 required=5.0 tests=FREEMAIL_FROM,FREEMAIL_REPLY,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL,WEIRD_PORT X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of sean.copenhaver@gmail.com designates 209.85.220.180 as permitted sender) Received: from [209.85.220.180] (HELO mail-vx0-f180.google.com) (209.85.220.180) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 12 Apr 2011 16:44:33 +0000 Received: by vxk12 with SMTP id 12so7993377vxk.11 for ; Tue, 12 Apr 2011 09:44:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=L8JnnNv8ONGS52syE5V9YBiWDUA2YObZ1EXQeJ4kn+E=; b=IzeIDJQWgcldg+fyKmb85h3PSBAVTL49pKmgh9WqfOZeci9PWm4VmsxQ0gWjbRS685 N4Ld4OF5Bpkyc6l3fD6aXFm/5p1Wln1V0OQOig7v8QRbZZASgcDfDOCL+nvmgjAEphvs kUs9FGpJVU3MhoRspP/ag7+RnBwNDCQyb97aQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=l8Idyqhu3pcbwFH83SjhFBvjJUg5MnIIaUbr8MhbT7QewtlnGNCnmkJmfkFCiylohD Lz3VK5T8+7V5XY5i+LFMktLZGNbOrWNMq5yKroFOMNRC/67JOjgq+8QGL6eK8Lu3gzDo rQd46VT98FrKSKSIYirkr1lMaiH+ds8HL4gqw= MIME-Version: 1.0 Received: by 10.52.91.232 with SMTP id ch8mr10080435vdb.85.1302626652162; Tue, 12 Apr 2011 09:44:12 -0700 (PDT) Received: by 10.52.161.230 with HTTP; Tue, 12 Apr 2011 09:44:12 -0700 (PDT) In-Reply-To: References: Date: Tue, 12 Apr 2011 12:44:12 -0400 Message-ID: Subject: Re: Redirect the welcome page without breaking Futon? From: Sean Copenhaver To: user@couchdb.apache.org Content-Type: multipart/alternative; boundary=20cf307c9c3ce08c6204a0bb6639 X-Virus-Checked: Checked by ClamAV on apache.org --20cf307c9c3ce08c6204a0bb6639 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Glad I could help. If you get the kinks worked out it would be great if you post some information about your final solution. I would imagine others wil= l find it useful (including me) one day. On Tue, Apr 12, 2011 at 12:32 PM, Hendrik Jan van Meerveld wrote: > Thank you Sean, > > I just tried it: it works! > > The rewrite should actually be: > { > "from" : "*", > "to" : "_show/show/welcome" > } > > And I need to do a lot of fine-tuning, but the first results look > promising. > Also need to put futon.domain.com in my hosts file I suppose. > > Kind regards, > Hendrik Jan > > On 11 April 2011 20:47, Sean Copenhaver wrote= : > > > I think you would have to do a virtual host for both futon and your app= . > > > > Something like: > > > > futon.domain.com =3D /_utils > > domain.com =3D /db/_design/app/_rewrite > > > > Then in _design/app/_rewrite, something like: > > { > > from: '/' > > to: '_show/show/welcome' > > } > > > > I have only played around with rewrites a little and have no couchdb > right > > now to test with, so someone would have to confirm. > > > > On Mon, Apr 11, 2011 at 2:10 PM, Hendrik Jan van Meerveld > > wrote: > > > > > Thank you Sean, > > > > > > I am not sure that your sollution will work in my special case. > > > It is an existing URL that I want to rewrite. > > > The URL 'www.domain.com/' gives the JSON result > > > '{"couchdb":"Welcome","version":"1.0.1"}' > > > and I want to rewrite it to a HTML welcome page. > > > Futon uses 'www.domain.com/' to check the Couchdb version and > therefore > > > the > > > rewrite will break Futon. > > > (Or am I wrong? Did anyone rewrite the domain root and still use > Futon?) > > > > > > > > > I did solve it in another way. I wrote one rewrite rule (nginx) for > port > > > 80, > > > like this: > > > > > > server { > > > server_name localhost www.domain.com domain.com; > > > listen [::]:80; > > > .... > > > location =3D/ { > > > rewrite ^ /db/_design/db/_show/show/home; > > > } > > > } > > > > > > and another rewrite rule for port 81 (without the rewrite for =3D/): > > > > > > server { > > > server_name localhost www.domain.com domain.com; > > > listen [::]:81; > > > .... > > > } > > > > > > This way if I go to 'www.domain.com:81/_utils' Futon is still working= . > > > > > > > > > Hopefully this will help other people to have a welcome page on the > > domain > > > root and still use Futon. > > > > > > Kind regards, > > > Hendrik Jan > > > > > > > > > > > > > > > On 10 April 2011 01:02, Sean Copenhaver > > wrote: > > > > > > > You can actually setup virtual hosts and url rewrites inside CouchD= B > to > > > > allow you to pretty much map any URL to a doc or function that you > > want. > > > It > > > > may allow you to go without nginx or with little relying on it: > > > > > > > > > > > > > > > > > > http://blog.couchbase.com/whats-new-in-apache-couchdb-0-11-part-one-nice-= urls > > > > > > > > > > > > -- > > > > Sean Copenhaver > > > > > > > > On Saturday, April 9, 2011 at 6:04 PM, Hendrik Jan van Meerveld > wrote: > > > > Hi Couch users, > > > > > > > > > > For my new Couchdb website I am looking to a way to achieve the > > > > following. > > > > > I would like my visitors to just type "http://www.mysite.com/" an= d > > be > > > > > redirected to another page. > > > > > > > > > > Using Nginx as a reverse proxy works if I use the following > rewrite: > > > > > > > > > > location / { > > > > > rewrite ^ /mydatabase/_design/main/_show/blah/home permanent; > > > > > proxy_pass http://localhost:5984; > > > > > proxy_redirect off; > > > > > proxy_set_header Host $host; > > > > > proxy_set_header X-Real-IP $remote_addr; > > > > > proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; > > > > > } > > > > > > > > > > The problem with this approach is that Futon starts complaining > > because > > > > the > > > > > welcome page is no valid JSON anymore. > > > > > > > > > > > > > > > Is there a way to redirect "http://www.mysite.com" and still keep > > > Futon > > > > > working. > > > > > > > > > > > > > > > Thanks for any help. > > > > > Kind regards, > > > > > Hendrik Jan > > > > > > > > > > > > > > > > > > > > -- > > =93The limits of language are the limits of one's world. =93 -Ludwig vo= n > > Wittgenstein > > > --=20 =93The limits of language are the limits of one's world. =93 -Ludwig von Wittgenstein --20cf307c9c3ce08c6204a0bb6639--