Hi,
is it possible to deliver an attachment through a show function?
i've tried this with no success:
GET
/images/_design/images/_show/onlineimage/a0cbe43b55828d33320cf6cbd40bdb81?attachments=true
function (doc, req) {
if (doc.type == "image" && doc.online == "online") {
return {
body: doc._attachments["filename"].data,
headers: { "content-type" :
doc._attachments["filename"].content_type}
}
}
else {
return 'not found or offline';
}
}
Reason is to rewrite this URL in varnish cache and only deliver images
which are flagged online in doc.online.
My application would ask for http://varnish/image/<imagedocid> and only
get online images.
I'm trying to avoid an extra http roundtrip through the application server.
any ideas how to accomplish this scenario?
regards,
jan prieser