Search code examples
curlweb-applicationshttp-status-code-405

Method not allowed when I do curl GET


I'm running a small webapp which should allow the following curl:

curl -I http://localhost:5000/yield

It gives me this 405 response though:

enter image description here

Does this mean my webapp doesn't allow this method or the server doesn't allow it and how do I resolve this? I'm on Windows 2019 Server.


Solution

  • curl -I makes a HEAD request, not a GET. Some servers simply disables the ability to do HEAD requests - I've never understood why.

    The Allow: response header there implies that this server only accepts GET on that resource, so try again without -I ? (maybe use -i instead of you want the headers too).

    You can also use -v to get to see the headers, but then they're not passed to the same destination as the body, as -i does. You decide!