Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Should a HTTP Allow header contain "OPTIONS"?

If a HTTP resource is not able to handle a request with the given HTTP method, it should send an Allow header to list the allowed HTTP methods. Another possibility to get a response with an Allow header is to send a request with the OPTIONS method.

I'm wondering whether the Allow header should contain the OPTIONS method itself.

Example:

Allow: GET, PUT, DELETE, OPTIONS

or

Allow: GET, PUT, DELETE

What is correct?

like image 992
deamon Avatar asked Dec 20 '12 21:12

deamon


People also ask

What does HTTP header contain?

HTTP headers let the client and the server pass additional information with an HTTP request or response. An HTTP header consists of its case-insensitive name followed by a colon ( : ), then by its value. Whitespace before the value is ignored.

What is an allow header?

The allow-header entry specifies which headers are presented in preflight responses to clients as acceptable to use when making cross-origin requests to resources which this policy is applicable to.

Why is there an options request before post?

Prevent sending the post data, if it wont be processed This is the only reason what is valid. Using options request will prevent sending the post data to the server unnecessarily.

Why do we need HTTP options?

The HTTP OPTIONS method is used to describe the communication options for the target resource. This method allows the client to determine the options and/or requirements associated with a resource, or the capabilities of a server, without implying a resource action or initiating a resource retrieval.


1 Answers

I don't see why not. The OPTIONS request method is used to request information about the communication options available for the requested URI. Some clients use OPTIONS to determine communication requirements and the server's capabilities without having to retrieve or perform an action on the requests resource.

like image 108
theabraham Avatar answered Oct 21 '22 17:10

theabraham