Created
September 8, 2014 16:52
-
-
Save arielcr/85433018bdccbab75b45 to your computer and use it in GitHub Desktop.
Laravel filter to allowOrigin
This file contains hidden or 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
Route::filter('allowOrigin', function($route, $request, $response) | |
{ | |
$response->header('access-control-allow-origin','*'); | |
}); |
Obvious, is necessary to put the routes into a group:
Route::group(['after' => 'allowOrigin'], function() {
Route::post('/users', function() {
// ...
});
});
And now works!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I configured my routes as following code:
But, the header not has Access-Control-Allow-Origin. Whats happens?