Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

2.1, i am also using the amazon elastic cache service (its a memcached server)

Nginx has a clever feature that uses memcached for common get request, but if is a post request dont use memcached, is anyway to disable this feature?

Here is my configuration;

location /{
    set_md5  $memcached_key "http://$server_name$uri";
    default_type text/html;
    add_header Content-Encoding gzip;
    error_page 405 404 = @fallback;

location @fallback{
    gzip_types text/css text/plain application/atom+xml application/x-javascript;
    gzip_vary on;
    #  stuff to do a normal render of the page
share|improve this question
Did you have any luck with this? I'm running into the same problem with 405 errors on post requests – Kevin Jun 26 '12 at 23:10
I couldn solve it using nginx rewrite... i have to add some code to the app. – Tim Jun 27 '12 at 2:59
up vote 2 down vote accepted

When you get POST request, it is supposed to change some objects in your backend's storage (database), which depends on the logic of your application. So, NGINX just has no idea about what actually must be done in your application and simply does not try to cache any POST request, redirecting them directly to your backend.

Meanwhile, GET requests are supposed only to read data, without any writing - so, it can be easily cached, because every time the result of reading would be the same.

share|improve this answer
You are right, im gone accept the answer because its okey. But in need that the nginx use memcache even in a POST petition. – Tim Sep 19 '12 at 13:06
Well.. Please, describe the detailed algorithm of caching for POST requests. Give me an example of it. Maybe, we could think out something working. – Dingo Sep 21 '12 at 23:59

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.