incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Anderson <>
Subject Re: workaround for cross-site PUTs
Date Tue, 09 Jun 2009 18:09:21 GMT
On Tue, Jun 9, 2009 at 10:17 AM, Wojciech
Kaczmarek<> wrote:
> Hi!
> I'm going to hack a Greasemonkey script which would automatically
> update CouchDB docs from a webpage content. It needs to be done at the
> browser side, server side is out of reach for modification.
> I can't use XMLHttpRequest as it doesn't allow cross-site requests.
> When using jQuery's ajax with jsonp (or whatever application of script
> tag injection) the requests are limited to GETs. So I'm going to have
> a layer in the CouchDB translating external GETs to document-writing
> PUTs.

You may be able to do POST using a hidden form in an iframe. This
would be posted as form encoded key value pairs, but CouchDB should be
able to handle those for creating a document - if it can't we should
make it handle those.

Otherwise you can wait for the _update mechanism to be ready, which
should be able to create a document in response to a get request.
(Still a bad idea but not super bad if it's triggered from

> Is couchapp able to do this with some of its helpers or should I set
> up external process catching the requests and sending appropiate PUTs?
> (I could set up proxies or intermediate webapp instead, but I want to
> avoid extra infrastructure and like an idea of making stuff able to
> couch-replicate as much as possible; that's why external process seems
> heavyweight as it requires preconfiguration instead of just
> replication.)
> cheers,
> Wojtek

Chris Anderson

View raw message