couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan Lehnardt <>
Subject Re: Attachment serving, directories
Date Sun, 21 Mar 2010 08:06:47 GMT

On 20 Mar 2010, at 23:01, 7zark7 wrote:

> Let me rephrase the question:
> Are there any CouchDB 0.10 mechanisms (views, show function, etc) which allows me to
serve a binary attachment that has one or more '/' characters in the requested file id?

Yes :)

> echo $COUCH
> curl -X PUT $COUCH/x
> curl -X PUT $COUCH/x/a -d '{"a":1}'
> curl -X PUT $COUCH/x/a/att/ach.txt?rev=1-23202479633c2b380f79507a776743d5 -d 'hello'
> curl -X GET $COUCH/x/a
curl -X GET $COUCH/x/a/att/ach.txt


> I do not care about the url prefix or its length. In other words, these prefixes are
all acceptable:
>{my file path here}
>{my file path here}
> etc
> What I do care about is that a browser can directly request a binary file such as "/scripts/main/common.js",
without our having to go into hundreds of HTML files to rename these file references to "%2Fscripts%2Fmain%2Fcommon.js".
 Nor do I want an app server or Apache in place simply to do a file name translation.
> The specific value proposition that CouchDB offers in this case is that it replaces:
> 1) Content distribution to multiple nodes in our network.
> 2) Replaces an app server/Apache serving static content.
> 3) It is highly concurrent.
> Does anyone have experience doing the above or similar?
> I can write a blog post if email is not conveying my question correctly.
> Thanks
> On 3/20/10 7:22 PM, John Merrells wrote:
>> On Mar 20, 2010, at 4:44 PM, 7zark7 wrote:
>>>> I do not want to have another webapp "in front" of Couch to translate a
>>>> request for "/scripts/main.js" into "%2fscripts%2fmain.js/data", or
>>>> "/a1b0e2349f53456/scripts/main.js", etc.
>> How about serving the static content directly from the disk with a webserver
>> like apache or nginx....
>> If you really want the content in couch, then you could do the url rewrite with
>> some rules in the webserver config...
>> Or use a reverse proxy like varnish.... or squid if you're feeling brave.... and
>> then the content could be in couch for versioning, but served fast from the
>> cache.
>> John

View raw message