couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexander Shorin <kxe...@gmail.com>
Subject Re: Faking External Attachments Using Reverse Proxy
Date Mon, 23 Mar 2015 13:27:55 GMT
On Mon, Mar 23, 2015 at 4:19 PM, Robert Nagy <robert.nagy@boffins.se> wrote:
> Rewriting the requests listed here http://docs.couchdb.org/en/latest/api/document/attachments.html
<http://docs.couchdb.org/en/latest/api/document/attachments.html> should not be a problem.
However, I’m unsure whether there are any other attachment related requests that we might
need to take into account. I’m in particular worried about the scenario where a CouchDB
with internal attachments syncs up with a database behind the proxy. What is the API for attachments
during sync/replication?

Here are the ways to bypass your proxy:

GET http://localhost:5984/db/doc?attachments=true
GET http://localhost:5984/db/_changes?include_docs=true&attachments=true
GET http://localhost:5984/db/_design/ddoc/_view/something?include_docs=true&attachments=true
GET http://localhost:5984/db/doc?open_revs=all ACCEPT: multipart/*

Replicator itself uses two ways to handle attachments:
0. Replicator fetches attachments using multipart request to /db/doc
resource with open_revs=[...] param;
1. Inline, when their size and amount are fits the inner
limitations[1]. Those who does been sent via POST /db/_bulk_docs
requests;
2. All the others are sent with multipart document update with PUT
/db/doc request.

So as you see, replicator will always bypass your proxy.

[1]: https://github.com/apache/couchdb-couch-replicator/blob/master/src/couch_replicator_worker.erl#L31-L32

--
,,,^..^,,,

Mime
View raw message