This config will assume that every request is a POST, and everything will be cached the same way.
We specify that the cache lifetime is 5 seconds, but it will only cache valid responses, so if you send back a 404, 50X etc, those won’t be cached at all.
Bear in mind if you have a large request body you’ll be hashing it every time and looking that up.
For testing I only wanted to cache for five seconds, which is defined in the .
Since we’re only interested in caching POST, we’ll just deal with that here, everything else can just drop through to the backend.
We can’t use a traditional key for the cache store, we need to make our own.
I can’t really blame them for simply enforcing the RFC though.
You’ll have to ignore the Ruby specifics below, but this is the Nginx config I used to get all this working with my test environment.