Allow the Cross Origin Request (CORS)

| By Webner

Cross Origin issue is resolved by adding header(“Access-Control-Allow-Origin:”); to allow the particular origin or we can also allow all the origin by replacing the path to *.

For Cake php header is defined in file public/index.php.



To view the origin is allowed or not then check the request header from network panel.

Response Headers:


Alternative: The problem is also resolved by defining middleware to

Route (

If in any case ajax request shows method not allowed then check the Request method defined in ajax request and confirm on headers (showing in above image).

Leave a Reply

Your email address will not be published. Required fields are marked *