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 A6B8C9017 for ; Mon, 21 May 2012 12:50:35 +0000 (UTC) Received: (qmail 18746 invoked by uid 500); 21 May 2012 12:50:34 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 18705 invoked by uid 500); 21 May 2012 12:50:33 -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 18692 invoked by uid 99); 21 May 2012 12:50:33 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 21 May 2012 12:50:33 +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 (athena.apache.org: domain of chris.hankey@transamerica.com designates 213.199.154.140 as permitted sender) Received: from [213.199.154.140] (HELO db3outboundpool.messaging.microsoft.com) (213.199.154.140) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 21 May 2012 12:50:26 +0000 Received: from mail14-db3-R.bigfish.com (10.3.81.228) by DB3EHSOBE002.bigfish.com (10.3.84.22) with Microsoft SMTP Server id 14.1.225.23; Mon, 21 May 2012 12:49:51 +0000 Received: from mail14-db3 (localhost [127.0.0.1]) by mail14-db3-R.bigfish.com (Postfix) with ESMTP id 8C409480455 for ; Mon, 21 May 2012 12:49:51 +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:mail2.aegonusa.com;EFVD:NLI Received-SPF: pass (mail14-db3: 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 mail14-db3 (localhost.localdomain [127.0.0.1]) by mail14-db3 (MessageSwitch) id 1337604589421485_835; Mon, 21 May 2012 12:49:49 +0000 (UTC) Received: from DB3EHSMHS007.bigfish.com (unknown [10.3.81.240]) by mail14-db3.bigfish.com (Postfix) with ESMTP id 5ACFC420274 for ; Mon, 21 May 2012 12:49:49 +0000 (UTC) Received: from aegonusa.com (162.123.17.224) by DB3EHSMHS007.bigfish.com (10.3.87.107) with Microsoft SMTP Server (TLS) id 14.1.225.23; Mon, 21 May 2012 12:49:46 +0000 Received: from ([162.123.17.230]) by crdcdmzim05.aegonusa.com with ESMTP with TLS id 21NVRH1.135813593; Mon, 21 May 2012 07:49:53 -0500 Received: from crexzix02.inet.nogea.local (ZixVPM [127.0.0.1]) by Outbound.aegonusa.com (Proprietary) with ESMTP id 4E759388396 for ; Mon, 21 May 2012 07:24:22 -0500 (CDT) Received: from CREXHTMAIL02.us.aegon.com (autodiscover.divinvest.com [162.123.194.95]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by crexzix02.inet.nogea.local (Proprietary) with ESMTP id B63DF388394 for ; Mon, 21 May 2012 07:24:21 -0500 (CDT) Received: from CRHKEXHTMAIL01.ds.global (162.123.229.102) by CREXHTMAIL02.us.aegon.com (162.123.229.94) with Microsoft SMTP Server (TLS) id 14.1.323.3; Mon, 21 May 2012 07:49:52 -0500 Received: from CREXHTMAIL03.us.aegon.com ([169.254.3.122]) by CRHKEXHTMAIL01.ds.global ([169.254.2.138]) with mapi id 14.01.0323.003; Mon, 21 May 2012 07:49:52 -0500 From: "Hankey, Chris" To: "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: AQHNNgnZKgquiatR0EuobIruJpzaQZbSC18QgABbroCAAAxUAIABwOyg Date: Mon, 21 May 2012 12:49:51 +0000 Message-ID: <6BA11CBD97F4DC469B8CB603C5B990FA237EB949@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> In-Reply-To: <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: {2346F53E-CA6F-492D-BE5D-B7477582B5D7} x-cr-hashedpuzzle: 2YA= AGEr AfeJ BSAb BWKi BwXY CPwR Cque DI9f EMoG EfQq FBGR FJAc GHIO GY+N HVoF;1;dQBzAGUAcgBAAGMAbwB1AGMAaABkAGIALgBhAHAAYQBjAGgAZQAuAG8AcgBnAA==;Sosha1_v1;7;{2346F53E-CA6F-492D-BE5D-B7477582B5D7};YwBoAHIAaQBzAC4AaABhAG4AawBlAHkAQAB0AHIAYQBuAHMAYQBtAGUAcgBpAGMAYQAuAGMAbwBtAA==;Mon, 21 May 2012 12:49:50 GMT;UgBFADoAIABDAGEAbABsACAAdABvACAAVgBpAGUAdwAgAHIAZQB0AHUAcgBuAHMAIAA0ADAANQAuACAAIABJAHQAJwBzACAAdQBzAGkAbgBnACAATwBQAFQASQBPAE4AUwAgAG4AbwB0ACAARwBFAFQA x-originating-ip: [162.123.56.60] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: 7562670a-beab-4c6e-8ed2-ab3b5287c042 X-OriginatorOrg: transamerica.com X-Virus-Checked: Checked by ClamAV on apache.org Thanks. Chris -----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