Perform Backend Request with a Body

Florian Gilcher flo at andersground.net
Thu Jul 15 12:39:50 CEST 2010


Hi,

This is kind of similar to the question "can I cache POSTs"?

My situation is the following: We use ElasticSearch[1] for search indexing and would like to put a varnish in front of it, to cache recurring queries for some time (we do a lot of automated queries). Now, ElasticSearch has a rather 'creative' HTTP Api, mostly due to their complex Query system, wrapped into a JSON format[2].

The ElasticSearch backend expects this JSON as body of either a GET or a POST request. The first is non-compliant, because servers should ignore bodies on GET-requests, the second is non-compliant because POSTs are not intended for reading data *sigh*. Nevertheless, thats what I am stuck with.

Now, back to varnish: it seem like varnish always strips the body before emitting a backend request if it is not in pass mode. Is there any way to circumvent this? I already send a special header containing a hash of the body to make it easier for varnish to lookup the object to this request. But without passing on the body, this is futile.

Is there a solution using VCL for this or should I look for other solutions?

Regards,
Florian

[1]: <http://elasticsearch.com>
[2]: <http://www.elasticsearch.com/docs/elasticsearch/rest_api/search/>
--
Florian Gilcher

smtp:   flo at andersground.net
jabber: Skade at jabber.ccc.de
gpg:    533148E2





More information about the varnish-misc mailing list