close

Slick­Stack

January 2025 promo! Join our Discord free of charge.

Slick­Stack
Lightning-fast WordPress on Nginx

Why does SlickStack block PUT and DELETE requests in Nginx

  • This topic is empty.
Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #3340
    Bruce
    Guest

    This has come up a few times so I thought we should have a forum thread for better SEO visibility… if you are using WordPress and Nginx and wondering why certain requests are result in 405 errors such as PUT, DELETE, PATCH etc…

    https://github.com/littlebizzy/slickstack/issues/116

    It’s because these are disallowed by default in modern servers for the most part, even if you’re not using SlickStack with Nginx.

    #3341
    Zachary
    Guest

    The immediate reaction from some “full stack” devs might be omg, WordPress is so annoying, or SlickStack is not working properly!

    This isn’t the case… it’s usually that they are using unsafe/old-fashioned requests in their WordPress plugin or whatever application having problems….

    #3342
    Robert
    Guest

    The truth is WordPress is pretty awesome here, because using the REST API you can send nearly anything using safer POST requests:

    https://gridpane.com/kb/making-nginx-accept-put-delete-and-patch-verbs/

    And then using query strings, you can generate pseudo-requests to accomplish things that are not typically included in POST requests, but can be with WordPress.

    Example:

    POST /wp-json/wp/v2/posts/42?_method=DELETE

    #3343
    Michelle
    Guest

    If you review that article from GridPane they also provide a free “hack” you can add to your Nginx using a small .conf file to redirect non-POST requests as needed.

    But for SlickStack we don’t plan on adding this by default because it’s really just patching poorly coded plugins, etc.

    The better solution is to fix the code in question to leverage the REST API better.

    #3344
    Jesse
    Guest

    More reading on this

    Routes and Endpoints

    #3430
    Richard
    Guest

    And then using query strings, you can generate pseudo-requests to accomplish things that are not typically included in POST requests, but can be with WordPress.

    Any properly coded WordPress plugin should be doing this via REST API.

    If your plugin is not doing this, hacking your Nginx to accept non-POST requests is just decreasing security and avoiding a long-term solution.

    #7707
    Gloria
    Guest
    #25357
    Arthur
    Guest
    #25817
    Beverly
    Guest

    Hey guys, I understand the consequences but for a short time I need to enable PUT request, is there a way to achieve this with SS?
    I am referring this guide: https://gridpane.com/kb/making-nginx-accept-put-delete-and-patch-verbs/

    But upon the SS monthly update PUT functionality will cease. please suggest how to keep edits even after the monthly updates.

    Thanks.

    #25818
    Edward
    Guest

    please suggest how to keep edits even after the monthly updates

    do you know which SlickStack cron job is overwriting your changes?

    #25852
    Douglas
    Guest

    Unfortunately. No.

    #25853
    Michael
    Guest

    afaik there is no cron job in SlickStack that overwrites Nginx config changes, unless you run ss install or ss install nginx config

    However the SS_LOCKDOWN="true" in your ss-config should also help avoid that. It’s still being worked on, with community feedback, but when true it will prevent certain things from being overwritten. It’s not fully supported yet, still being developed.

Viewing 12 posts - 1 through 12 (of 12 total)
Reply To: Why does SlickStack block PUT and DELETE requests in Nginx

Thanks to our generous sponsors for their support!