POST, memcached, 405, and gateway timeouts

Igor Sysoev is at rambler-co.ru
Fri Jun 20 23:56:06 MSD 2008


On Thu, Jun 19, 2008 at 04:48:09PM -0400, nginx at thomer.com wrote:

> I have the following situation:
> 
>   location ~ "foo" {
>     error_page 404 = /;
>     error_page 405 =200 /;
>   
>     set $memcached_key "default";
>     if ($request_uri ~ "bar") {
>       set $memcached_key "non-default";
>     }
>     memcached_pass ...;
>   }
>   
>   location / {
>     proxy_pass ...;
>   }
> 
> The "error_page 405 =200 /;" is there to make sure that POST requests
> fall through to the "location /" block (since nginx returns 405s on
> a POST when trying to serve cached content).
> 
> The problem is that this setup causes gateway timeouts.  I verified that
> the backend is up, though: if I comment out the first location block,
> everything works fine.  In other words, the backend is up.
> 
> Essentially, I'm trying to serve cached content for GET request and fall
> back to the backend for POST requests.

Could you create debug log ?

BTW, it better to split "foo" and "bar":

   location ~ "bar" {
       error_page 404 = /;
       error_page 405 =200 /;

       set $memcached_key "non-default";
       memcached_pass ...;
   }

   location ~ "foo" {
       error_page 404 = /;
       error_page 405 =200 /;
   
       set $memcached_key "default";
       memcached_pass ...;
   }


-- 
Igor Sysoev
http://sysoev.ru/en/





More information about the nginx mailing list