nginx, 405 Not allowed against PUT method

Hi there! Please help, I’m trying to make my nginx reverse proxy work with my node.js restful api, but always getting 405 Not allowed error on PUT request. I’ve already tried to include “dav_methods PUT DELETE;” line in my config but it seems not working. Server runs with --with-http_dav_module flag in Ubuntu 12.04. here is my config: server { listen 80;


location /site/ {
    dav_methods PUT DELETE;
    proxy_pass http://localhost:1337/;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection 'upgrade';
    proxy_set_header Host $host;
    proxy_cache_bypass $http_upgrade;

} Thanks in advance!

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

I had a similar problem running a simple REST-like API using Nginx and PHP. <br> <br>First of all, I think using the the http_dav_module and its dav_methods is just wrong, so remove that (we’re not doing WebDav). <br> <br>My problem was that I was relying on index (ngx_http_index_module) to take my “/” requests to “/index.php” , but the ngx_http_index_module does not like PUT and DELETE. So if you have an “index” directive, try to remove or replace it and see if that helps. <br> <br>I now use a rewrite to send requests to “/” to “/index.php” like this: <br> <br> location = / { <br> rewrite / /index.php last; <br> } <br> <br> <br>(I’m not a ngnix pro, so take all of the above with a grain of salt :)

thank for the answers, I restart the server every time I edit the config, and my config is taken exactly from that local tutorial. I’ve googled a lot of stuff on this topic and this problem seems unsolvable, thus nginx reverse proxy doesn’t allow to use at least PUT and DELETE methods

Have you restarted nginx after editing the config file?