From user-return-20887-apmail-couchdb-user-archive=couchdb.apache.org@couchdb.apache.org Mon May 21 13:40:09 2012 Return-Path: X-Original-To: apmail-couchdb-user-archive@www.apache.org Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 252D0CD42 for ; Mon, 21 May 2012 13:40:09 +0000 (UTC) Received: (qmail 48846 invoked by uid 500); 21 May 2012 13:40:07 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 48781 invoked by uid 500); 21 May 2012 13:40:07 -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 48773 invoked by uid 99); 21 May 2012 13:40:07 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 21 May 2012 13:40:07 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of chris.hankey@transamerica.com designates 216.32.181.185 as permitted sender) Received: from [216.32.181.185] (HELO ch1outboundpool.messaging.microsoft.com) (216.32.181.185) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 21 May 2012 13:39:59 +0000 Received: from mail54-ch1-R.bigfish.com (10.43.68.249) by CH1EHSOBE013.bigfish.com (10.43.70.63) with Microsoft SMTP Server id 14.1.225.23; Mon, 21 May 2012 13:39:24 +0000 Received: from mail54-ch1 (localhost [127.0.0.1]) by mail54-ch1-R.bigfish.com (Postfix) with ESMTP id C2B1F601D7 for ; Mon, 21 May 2012 13:39:24 +0000 (UTC) X-SpamScore: -15 X-BigFish: VPS-15(zz9371I542M1432N98dKzz1202hzz8275bh8275dhz2fh2a8h668h839h944hd25hf0ah) X-Forefront-Antispam-Report: CIP:162.123.17.224;KIP:(null);UIP:(null);IPV:NLI;H:aegonusa.com;RD:email3.aegonusa.com;EFVD:NLI Received-SPF: pass (mail54-ch1: domain of transamerica.com designates 162.123.17.224 as permitted sender) client-ip=162.123.17.224; envelope-from=chris.hankey@transamerica.com; helo=aegonusa.com ;aegonusa.com ; Received: from mail54-ch1 (localhost.localdomain [127.0.0.1]) by mail54-ch1 (MessageSwitch) id 1337607562975403_18365; Mon, 21 May 2012 13:39:22 +0000 (UTC) Received: from CH1EHSMHS009.bigfish.com (snatpool2.int.messaging.microsoft.com [10.43.68.238]) by mail54-ch1.bigfish.com (Postfix) with ESMTP id DDA8C120056 for ; Mon, 21 May 2012 13:39:22 +0000 (UTC) Received: from aegonusa.com (162.123.17.224) by CH1EHSMHS009.bigfish.com (10.43.70.9) with Microsoft SMTP Server (TLS) id 14.1.225.23; Mon, 21 May 2012 13:39:21 +0000 Received: from ([162.123.17.230]) by crdcdmzim05.aegonusa.com with ESMTP with TLS id 21NVRH1.135824425; Mon, 21 May 2012 08:39:32 -0500 Received: from crexzix03.inet.nogea.local (ZixVPM [127.0.0.1]) by Outbound.aegonusa.com (Proprietary) with ESMTP id 20893E38398 for ; Mon, 21 May 2012 08:43:44 -0500 (CDT) Received: from CREXHTMAIL01.us.aegon.com (autodiscover.transamerica.com [162.123.194.95]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by crexzix03.inet.nogea.local (Proprietary) with ESMTP id 8403CE38384 for ; Mon, 21 May 2012 08:43:43 -0500 (CDT) Received: from CREXHTMAIL03.us.aegon.com ([169.254.3.122]) by CREXHTMAIL01.us.aegon.com ([169.254.1.147]) with mapi id 14.01.0323.003; Mon, 21 May 2012 08:39:31 -0500 From: "Hankey, Chris" To: "Hankey, Chris" , "user@couchdb.apache.org" Subject: RE: Call to View returns 405. It's using OPTIONS not GET Thread-Topic: Call to View returns 405. It's using OPTIONS not GET Thread-Index: AQHNNgnZKgquiatR0EuobIruJpzaQZbSC18QgABbroCAAAxUAIABwOyggAANwlA= Date: Mon, 21 May 2012 13:39:30 +0000 Message-ID: <6BA11CBD97F4DC469B8CB603C5B990FA237EB9BA@CREXHTMAIL03.us.aegon.com> References: <4FB69C07.7070705@cedarsoft.com> <4FB6B7BC.9080403@cedarsoft.com> <4FB7F7D7.2040203@cedarsoft.com> <6BA11CBD97F4DC469B8CB603C5B990FA237EA17C@CREXHTMAIL03.us.aegon.com> <6BA11CBD97F4DC469B8CB603C5B990FA237EA1A3@CREXHTMAIL03.us.aegon.com> <304B4E33-691C-4833-96C8-CE5C446473BC@sri.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-cr-puzzleid: {FC288F70-5878-4C1C-97FF-0C03D9BF6ED6} x-cr-hashedpuzzle: AP7Z Auzj BOBv CfPi DTIB DpVm EDyd ED6K Gw7j Hbyg IMrs IWWU JoLM Jysv KHQL MRwr;1;dQBzAGUAcgBAAGMAbwB1AGMAaABkAGIALgBhAHAAYQBjAGgAZQAuAG8AcgBnAA==;Sosha1_v1;7;{FC288F70-5878-4C1C-97FF-0C03D9BF6ED6};YwBoAHIAaQBzAC4AaABhAG4AawBlAHkAQAB0AHIAYQBuAHMAYQBtAGUAcgBpAGMAYQAuAGMAbwBtAA==;Mon, 21 May 2012 13:39:28 GMT;UgBFADoAIABDAGEAbABsACAAdABvACAAVgBpAGUAdwAgAHIAZQB0AHUAcgBuAHMAIAA0ADAANQAuACAAIABJAHQAJwBzACAAdQBzAGkAbgBnACAATwBQAFQASQBPAE4AUwAgAG4AbwB0ACAARwBFAFQA x-originating-ip: [162.123.56.60] x-exclaimer-md-config: 7562670a-beab-4c6e-8ed2-ab3b5287c042 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: transamerica.com Another question then. If my page is being served on port 80 on server "te= st" & couchDB is on the default 5489 port, also on server "test", then how= do I call couch? It seems that if I set the urlPrefix property with the 5= 489 port then I get the 405 error. But if I don't set property then couch = uses a GET but calls port 80. =20 //this line causes a 405, but commenting out this line sends couch to port = 80 $.couch.urlPrefix =3D"http://test:5984" Does my choice of browsers affect this? I'm using Chrome because I like th= e developer tools that come with it. -----Original Message----- From: Jim Klo [mailto:jim.klo@sri.com]=20 Sent: Sunday, May 20, 2012 1:03 AM To: Cc: Subject: Re: Call to View returns 405. It's using OPTIONS not GET And if I had scrolled down further and put 2 and 2 together. You must be ma= king a cross origin request. If OPTIONS is returning with 405 the address i= n the browser is different than your CouchDB. More on Cross Origin Resource= Sharing here: http://www.w3.org/TR/cors/ AFAIK CouchDB still doesn't support CORS except via JSONP which you can ena= ble (I hear it's on a wish list tho!). However, I don't think the jquery.co= uch yet supports JSONP either. If you need to do XSS then, I remember hacki= ng it a while back to support JSONP https://github.com/jimklo/lrchart/blob/= master/lr-stats/_attachments/scripts/jquery.couch-patched.js but don't reca= ll how complete it is. There's a list and show function modification that can be made to support C= ORS, but not sure where that snippet lives in the Internet ether.=20 - Jim Sent from my iPad On May 19, 2012, at 9:19 PM, "Jim Klo" wrote: > An OPTIONS request is made by your browser when you make a Cross Origin R= equest. Is your App on the same domain and port as CouchDB? >=20 > Sent from my iPad >=20 > On May 19, 2012, at 3:51 PM, "Hankey, Chris" wrote: >=20 >> This is just some more info. Where is "OPTIONS" coming from? It looks = like the view function tries to use GET, but we end up with OPTIONS. >>=20 >> OPTIONS http://test:5984/forms/_design/formlist/_view/formlist HTTP/1.1 >> Host: test:5984 >> Connection: keep-alive >> Access-Control-Request-Method: GET >> Origin: null >> User-Agent: Mozilla/5.0 (Windows NT 5.1) AppleWebKit/535.19 (KHTML, like= Gecko) Chrome/18.0.1025.168 Safari/535.19 >> Access-Control-Request-Headers: origin, content-type, accept >> Accept: */* >> Accept-Encoding: gzip,deflate,sdch >> Accept-Language: en-US,en;q=3D0.8 >> Accept-Charset: ISO-8859-1,utf-8;q=3D0.7,*;q=3D0.3 >>=20 >>=20 >> -----Original Message----- >> From: Hankey, Chris [mailto:Chris.Hankey@Transamerica.com]=20 >> Sent: Saturday, May 19, 2012 5:54 PM >> To: user@couchdb.apache.org >> Subject: Call to View returns 405. It's using OPTIONS not GET >>=20 >> I'm trying to call a view using the CouchDB Javascript API. The $db.vie= w call is failing with a "405 Method Not Allowed" error. $db.view is gener= ating the correct URL, but the call appears to be failing because the view = function is using HTTP OPTIONS method ( or maybe JQuery). If I change the = HTTP method to GET & manually send the HTTP request, then it works fine. I= need $db.view to generate a GET. Any thoughts? >>=20 >> Thanks >>=20 >> Chris >>=20 >> ----------- >> Sample Code >> ----------- >>=20 >> $.couch.urlPrefix =3D"http://test:5984" >> $db =3D $.couch.db("forms"); >>=20 >>=20 >> function GetFormList() { =20 >> $("div#forms").empty(); =20 >> $db.view("formviews/formlist", { =20 >> success: function(data) { =20 >> for (i in data.rows) { =20 >> id =3D data.rows[i].id; =20 >> html =3D '
' + =20 >> '' + id + ' ' + =20 >> 'edit '+ =20 >> 'delete '+ =20 >> '
'; =20 >> $("div#forms").append(html); =20 >> } =20 >> }}); =20 >> } =20 >>=20 >>=20 >>=20