There are circumstances where a HTTP server will return a list of supported methods for a given resource in its Allow
response header, according to RFC 7231 (the new RFC for HTTP 1.1 semantics):
- First in the response to an
OPTIONS
request, either on a specific resource path, or on the special *
path (which would mainly describe the capabilities of the server);
- Second, if a method which is known, but not supported by the server on a given resource is tried, the server can respond with a 405 Method Not Allowed status code; in that case, it must give the list of allowed methods in the
Allow
response header;
- For any other HTTP request, the origin server is allowed to return a list of supported methods in the
Allow
response header;
But what if the server does not cooperate? E.g. you have tried an OPTIONS *
request, various GET
requests, and the server never returns a list of allowed methods in an Allow
header? Or what if the server replies, but you suspect that it is lying?
Then you do not know, and you will have to live with it. What you will do will depend on your goal:
- If you are simply trying to use the target system, you should do the cautious thing by assuming that only
GET
is supported, and obtain more documentation about how to use the system;
- If you are doing penetration testing, then you can test all the known verbs, test some less known ones (such as
PATCH
) or even invent some of your own; more generally, part of the test would be throwing garbage at the system to see how it reacts;
However, think about why you want to know the list of supported verbs - because without additional data, knowing which verbs are used is close to useless (e.g. I know that https://accounts.google.com/AddSession
accepts the POST
verb - what good does simply knowing the verb do to me if I do not know what data should be in, in what format, etc.?)