What I’m doing is mildly insane, but since GET requests have very strict size limit, solr uses POST requests to /solr/select URL to do what is “semantically” a GET.
I’m trying to put varnish in front of solr to do some caching. I put this in vcl_recv function:
if (!(req.request == "GET" || req.request == "HEAD" ||
(req.request == "POST" && req.url == "/solr/select"))) {
/* We only deal with GET and HEAD by default */
/* Modified to support POST to /solr/select */
return (pass);
}
and varnish now tries to handle that except it automatically converts a POST to a GET.
I’m aware all of that is fairly ridiculous and far from any best practices, but in any case, is there an easy way to use varnish this way?
You could try changing the req.POST into a GET, and transform the POST data to GET parameters (you probably would have to use inline-C) and do a lookup / fetch.
This GET request limit from the HTTP spec is not necessarily implemented by either Varnish or your back-end server. As you don’t depend on intermediate caches and User-Agents outside your control to handle long urls, you could give it a try.