When I use nginx as reverse proxy in front of some other web application, it seems not to forward PUT
requests, but shows an HTTP 405 generated by nginx (and not the upstream server).
I tried the proxy_next_upstream
method for http_405, but it did not work. I wonder why nginx itself checks the HTTP method anyway for a location block which has a reverse_proxy configured.
Nginx is not the problem here. It forwards
PUT
requests in reverse proxy blocks as expected, if thelocation
matches the request.I had another
location
directive, which makes sure images are not served via the reverse proxy. It matched everything with.png
(and some other file extensions) in the end, which matched the upload-urls as well.For the wrong location block, the error 405 is correct. The solution is to make sure the upload requests are actually forwarded into the reverse proxy.
An example for a working reverse proxy configuration:
The configuration works fine, if there are no other location blocks, which take precedence.
My problem was another block: