Skip to content

Instantly share code, notes, and snippets.

@matthewbeta
Forked from davidohlin/readme.md
Created June 2, 2021 10:41
Show Gist options
  • Save matthewbeta/2cf711da9274cddf510561b8ceb56c84 to your computer and use it in GitHub Desktop.
Save matthewbeta/2cf711da9274cddf510561b8ceb56c84 to your computer and use it in GitHub Desktop.
Homestead allow CORS (with Sprig for Craft CMS)

Working allow CORS Homestead (with Sprig for Craft CMS)

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,hx-current-url,hx-request,hx-target,hx-t>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment