• Resolved meken

    (@meken)


    Hi,

    I am using varnish + nginx.

    I cannot save api token or change to SVG:
    Couldn’t save those changes

    Request URL: https://www.xxx.com/wp-json/font-awesome/v1/config
    Request Method: PUT
    Status Code: 409 
    Remote Address: -:443
    Referrer Policy: strict-origin-when-cross-origin

    error log:
    *58 cannot PUT to a collection, client: -, server: xxx.com, request: “PUT /wp-json/font-awesome/v1/config HTTP/1.1”

    sometime *17,*749,*1337 cannot PUT to a collection

    Do you have a clue? Thanks.

    • This topic was modified 2 years, 8 months ago by meken.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author mlwilkerson

    (@mlwilkerson)

    @meken Sorry, I’ve not seen this particular error before.

    I have seen problems with 405 “Method Not Allowed” errors for PUT requests before. That has occurred when the web server configuration, usually managed by a web host provider, has set up rules that only allow some HTTP verbs, and reject PUT. The solution in those cases has been to change the configuration to allow PUT, at least for known legitimate routes like the REST route for this plugin as shown in your error message.

    There’s no place in this plugin code that it returns a 409 error. So this does seem like a response that’s coming from some layer of the system outside of this plugin.

    Varnish is a cache system, right? I can’t think of a reason that it should be involved in caching anything related to any routes under /wp-json/font-awesome/v1. Any end points under that path would be REST API routes used by this plugin for admin management of the plugin’s configuration. Could you change the Varnish config to just ignore those routes and allow requests to pass through un-varnished?

    Thread Starter meken

    (@meken)

    Hello mlwilkerson,

    Thanks for your answer.

    I found:

    When I visit:
    https://www.xxxxxx.com/wp-json/font-awesome/v1/config

    It is 404.

    https://www.xxxxx.com/wp-json/font-awesome/v1

    It is 200.

    Do you know why?

    Plugin Author mlwilkerson

    (@mlwilkerson)

    When you say you visit those URLs, do you mean that you just put those URLs into a web browser?

    If so, then what your browser is probably doing is sending a GET request to those routes.

    For font-awesome/v1, I would expect it to return 200 because it is valid to send a GET request to that route to list the routes and available methods under that namespace.

    I would expect a 404 on font-awesome/v1/config because GET is not a valid method for that route. That route only accepts PUT requests.

    Either way, that doesn’t seem to shed too much light on the original problem. It’s possible that your server has different rules for handling PUT requests than GET requests.

    Thread Starter meken

    (@meken)

    I have fixed it:

    nginx configuration:

    location /wp-json/ { # Resolves WP Gutenberg 404 issue
    try_files $uri $uri/ /index.php;
    }

    Credit: https://wordpress.stackexchange.com/questions/253734/wp-json-return-404-but-wp-json-wp-v2-works-fine-on-my-nginx-server/379352#379352

    Thread Starter meken

    (@meken)

    Closed as solved, thank you.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Couldn’t save those changes’ is closed to new replies.