Last active
January 14, 2016 14:03
-
-
Save kn9ts/5907fae0942e4dc34e15 to your computer and use it in GitHub Desktop.
Enabling CORS in Laravel
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
// Allow No 'Access-Control-Allow-Origin' header in Laravel | |
// http://stackoverflow.com/questions/28096827/allow-no-access-control-allow-origin-header-in-laravel | |
App::before(function ($request, $response) | |
{ | |
header('Access-Control-Allow-Origin: *'); | |
header('Access-Control-Allow-Methods: GET, POST, OPTIONS'); | |
header('Access-Control-Allow-Headers: Origin, Content-Type, Accept, Authorization, X-Request-With'); | |
header('Access-Control-Allow-Credentials: true'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment