Skip to content

Instantly share code, notes, and snippets.

@robozavri
Created January 15, 2019 12:05
Show Gist options
  • Save robozavri/45ac28bcaa595ff56c28da9afdfad983 to your computer and use it in GitHub Desktop.
Save robozavri/45ac28bcaa595ff56c28da9afdfad983 to your computer and use it in GitHub Desktop.
laravel Access-Control-Allow-Origin from origin 'http://localhost:8080' has been blocked by CORS policy
The simple answer is to set the Access-Control-Allow-Origin header to localhost or *. Here's how I usually do it:
Add the following code to bootstrap/app.php:
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: *');
header('Access-Control-Allow-Headers: *');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment