couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From payam yousefi <payam.youse...@gmail.com>
Subject cross domain or cross sub-domain
Date Wed, 22 Dec 2010 13:07:03 GMT
Hello Couchers
I have application written in JavaScript that store as couchdb design doc
and run on browser.
I defined v-host for this application as below:
I have dbname = *agaton* and application design doc = *lbd* so
*app.lbd.com = /agaton/_design/lbd/_rewrite  *
it means send all of my request to my rewrite handler. it works well.
now I'm trying to POST a request from this application (lbd) to other child
domain *mylogger.lbd.com*.
it means I'm going to cross *sub-domain *(not cross-domain)  and i think
cross sub-domain is not against same origin policy let me know if I'm wrong.
and there is a v-host definition for *mylogger.lbd.com* too as below :
I have dbname = *mylogger* so
*mylogger.lbd.com = /**mylogger*
but the problem is when i try to POST or PUT a document

$.ajax({
          url:"http://mylogger.lbd.com:5984",
          type:"POST",
          contentType: "application/json",
          dataType: "json",
          data: {name:"payam"},
          complete: function(req) {
                    var resp = $.httpData(req, "json");
                    if (req.status == 201) {
                        alert("success:" + resp)
                    } else {
                        alert(resp.reason);
                    }
          }
   });

It fails couchdb log:

[Wed, 22 Dec 2010 12:35:52 GMT] [debug] [<0.97.0>] Vhost Target:
'"/mylogger/"'

[Wed, 22 Dec 2010 12:35:52 GMT] [debug] [<0.3358.1>] 'OPTIONS' /mylogger/
{1,1}
Headers:
[{'Accept',"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"},
          {'Accept-Charset',"ISO-8859-1,utf-8;q=0.7,*;q=0.7"},
          {'Accept-Encoding',"gzip,deflate"},
          {'Accept-Language',"en-us,en;q=0.5"},
          {"Access-Control-Request-Method","POST"},
          {'Cache-Control',"no-cache"},
          {'Connection',"keep-alive"},
         * {'Host',"mylogger.lbd.com:5984"},*
          {'Keep-Alive',"115"},
       *   {"Origin","http://app.lbd.com:5984"},*
          {'Pragma',"no-cache"},
          {'User-Agent',"Mozilla/5.0 (X11; U; Linux i686; en-US;
rv:1.9.2.10) Gecko/20100922 Ubuntu/10.10 (maverick) Firefox/3.6.10"},
          {"x-couchdb-vhost-path","/"}]
[Wed, 22 Dec 2010 12:35:52 GMT] [debug] [<0.3358.1>] OAuth Params: []
[Wed, 22 Dec 2010 12:35:52 GMT] [info] [<0.3358.1>] 192.168.128.19 - -
'OPTIONS' /mylogger/ 405
[Wed, 22 Dec 2010 12:35:52 GMT] [debug] [<0.3358.1>] httpd 405 error
response:
* {"error":"method_not_allowed","reason":"Only DELETE,GET,HEAD,POST
allowed"}*

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message