I know ‘if’ is evil, and in general shouldn’t be used inside a
location block, but I needed this ability as well and have been using
the following without any trouble for a couple years.
If anyone has any better ideas, I’d love to hear them. So far, I
haven’t been able to find any without having to patch the source.
While we’re on the topic, I know there’s been talk of allowing POST
requests to static files, but I don’t remember a clear behavior being
defined. When added to nginx, will this simply serve the static file
as though a GET request was made? Ideally, one would be able to
specify that POST requests should always be proxied to an upstream
(which is what my config above does).
Maybe something like this in the config:
handle just like a GET request
allow_static_post on;
proxy to upstream
allow_static_post proxy_pass http://app_servers;
I don’t use FCGI or PHP, so I’m not sure how the config would look for
those, but you get the idea.
As static module will return 405 for POST request this is
mostly identical to what you currently has (though it will also
pass to app servers other methods unknown to static module, e.g.
PUT).
allow_static_post on;
proxy to upstream
allow_static_post proxy_pass http://app_servers;
I don’t use FCGI or PHP, so I’m not sure how the config would look for
those, but you get the idea.
This log doesn’t shows any problems, and it’s not even for POST
request. Instead it shows perfectly ok GET request (returning 304
not modified, as request includes If-Modified-Since).
In my case problem was solved, as it was incorrect rewrite rule and the
PHP script never received control, hence - 405. May I suggest that all
who receive 405 responses first check whether rewrite rules are
correctly configured.
Hm very bad to proxy, I manually applied the patch that were postet. And
finally it will works.
One File I needed to edit manually, but know Igor’s Patch is working.
I have the same issue here running Rails 2 apps virtual hosts on Debian
Squeeze.
In my case I, the error occur when I perform update with the PUT
method.
That’s solve my problem: