Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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";
    memcached_pass cacheviews.bsd7na.0001.use1.cache.amazonaws.com:11211;
    default_type text/html;
    add_header Content-Encoding gzip;
    error_page 405 404 = @fallback;
}

location @fallback{
    internal;
    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
add comment

1 Answer

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
1  
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
add comment

Your Answer

 
discard

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.