DELAPARRA
Index
Color
NL
Category: HTTP headers

Access-Control-Allow-Methods

Explained by Updated

What is Access-Control-Allow-Methods?

Access-Control-Allow-Methods: Sent in preflight responses (200 OPTIONS) listing which HTTP methods are allowed cross-origin. Access-Control-Allow-Methods is another preflight answer. It tells the browser which HTTP methods are allowed for cross-origin requests to this URL, for example GET, POST, PUT, DELETE. Simple GET and POST requests with standard headers do not need a preflight. As soon as you send PUT, PATCH or DELETE from another origin, the browser checks first. If the method is not listed, the request never reaches your application code.

Definition source Coders Lingo, CC BY 4.0

Frequently asked questions about Access-Control-Allow-Methods

What should you keep in mind with Access-Control-Allow-Methods?

A common confusion is that the API works fine in Postman or curl but fails in the browser. Those tools do not enforce CORS, so they never send a preflight. If an endpoint works there and not in your front end, look at the OPTIONS response in the browser's network tab and check whether this header includes the method you are using.

What does an example of Access-Control-Allow-Methods look like?

Access-Control-Allow-Methods: GET, POST, PUT, DELETE

At a glance

CategoryHTTP headers
Explained by
Updated

More HTTP headers terms

All terms starting with A

Skills

Download all skills (zip)

Manuals

Related services

Need any help?

Stuck on one of these in your own project? Tell me what you are working on and I will tell you how I would approach it.