Transform POST request to GET and pass body in URL

Kip Coul kipcoul at gmail.com
Thu Mar 26 12:12:34 UTC 2015


Hello,

I am using Varnish as a cache and reverse-proxy to distribute requests
between different backend workers. The workers expect some parameters,
that can be passed either through GET or POST.

The way Varnish works is by caching and distributing requests based on
the URL. So all GET requests are fine, because the parameters are in
the URL.

However, POST requests are not, because parameters are within the
body, so requests are not cached and distributed to one backend worker
only, which then gets all the load.

What I'd like to do is transform POST requests to GET requests, by
encoding the POST body content in the URL and pass a subsequent GET to
the Varnish cache.

Do you think this is possible? If so, how?

Many thanks for your help!

Regards,
Kip



More information about the nginx mailing list