meta

HTTP OPTIONS

Asks the server which communication options (methods, headers, CORS rules) are available for the target resource. Widely used by browsers as the CORS preflight before non-simple cross-origin requests.

OPTIONS /path HTTP/1.1  or  OPTIONS * HTTP/1.1

Properties

Property Value / Meaning
Safe Yes - OPTIONS only inspects capabilities; no state changes.
Idempotent Yes - repeated OPTIONS calls return the same capability set.
Cacheable No by default - though CORS preflights are cached client-side per Access-Control-Max-Age.
Has body Optional - a body is allowed but usually omitted.
Body in response Usually empty - key info arrives in the Allow and Access-Control-* headers.

Examples

curl -X OPTIONS -i https://api.example.com/users

Inspect Allow header to see supported methods.

curl -X OPTIONS -H 'Origin: https://app.example.com' -H 'Access-Control-Request-Method: PUT' -i https://api.example.com/users/1

Simulate a CORS preflight for a PUT from a browser.

curl -X OPTIONS -i 'https://example.com/*'

Server-wide capabilities via the asterisk-form request-target.

OPTIONS * HTTP/1.1\nHost: example.com

Raw asterisk-form asking about the server itself, not a specific resource.

Gotcha

Look at the Allow response header for supported verbs. In CORS, the preflight must return the exact requested method in Access-Control-Allow-Methods and echo any custom headers.

Related methods

← All HTTP methods · HTTP status codes · HTTP headers