Last active
November 7, 2023 15:43
-
-
Save yashuarc/10080747 to your computer and use it in GitHub Desktop.
Enabling CORS on CakePHP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function beforeFilter() { | |
parent::beforeFilter(); | |
$this->response->header('Access-Control-Allow-Origin','*'); | |
$this->response->header('Access-Control-Allow-Methods','*'); | |
$this->response->header('Access-Control-Allow-Headers','X-Requested-With'); | |
$this->response->header('Access-Control-Allow-Headers','Content-Type, x-xsrf-token'); | |
$this->response->header('Access-Control-Max-Age','172800'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The middleware
And in
Application.php