POST, memcached, 405, and gateway timeouts

nginx at thomer.com nginx at thomer.com
Fri Jun 20 00:48:09 MSD 2008


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.

Any help would be appreciated.

Thanks.

Thomer





More information about the nginx mailing list