I use nginx to serve static pages, but to pass API requests to a Tornado application that I would like to handle with GET, POST, PUT and DELETE requests.
GET and POST requests are fine, but PUT and DELETE requests are rejected with "405: method not allowed"
This question asks the same thing: How to allow a PUT file request on a Nginx server? but the answer does not solve my problem, which makes me think it is related to my use of proxy_pass in my setup.
Here is my nginx server configurator:
upstream TornadoAPI {
server 127.0.0.1:8000;
}
server {
listen 80;
listen [::]:80 default_server ipv6only=on;
root /usr/share/nginx/html;
index index.html index.htm;
server_name localhost;
location /<<static url>>/ {
root /var/www;
index index.html;
try_files $uri $uri/ /index.html;
}
location /<<API url>>/ {
dav_methods PUT DELETE;
dav_access all:r;
proxy_pass http://TornadoAPI/api/;
}
}
HttpDavModule ( , HttpDav - ) . , nginx -V.
nginx access.log:
<<IP address>> - - [06/Mar/2014:16:29:57 +0000] "PUT /<<API url>>/<<resource>> HTTP/1.1" 405 87 "<<ngix server root url>>" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.146 Safari/537.36"
- , , PUT DELETE?