Skip to content

Instantly share code, notes, and snippets.

@davidohlin
Last active June 2, 2021 10:41
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save davidohlin/7bf7ad9499b2a2193b8019661be9be94 to your computer and use it in GitHub Desktop.
Save davidohlin/7bf7ad9499b2a2193b8019661be9be94 to your computer and use it in GitHub Desktop.
Homestead allow CORS

Working allow CORS Homestead

Place the following in the server block of your sites nginx config, ie /etc/nginx/sites-enabled/example.com

# Allow CORS
add_header 'Access-Control-Allow-Origin' '*' always;
add_header 'Access-Control-Allow-Credentials' 'true' always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS' always;
add_header 'Access-Control-Allow-Headers' 'Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Requested-With' always;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment