Skip to content

Instantly share code, notes, and snippets.

@KojoEnch
Forked from derekclee/default.vcl
Last active April 3, 2022 15:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KojoEnch/a12d8eab7ff20aec2908144c0352c1da to your computer and use it in GitHub Desktop.
Save KojoEnch/a12d8eab7ff20aec2908144c0352c1da to your computer and use it in GitHub Desktop.
Varnish Cache Set CORS headers
sub vcl_deliver {
if (req.http.host == "my.wonderful.cms") {
set resp.http.Access-Control-Allow-Origin = "https://my.beautiful.app";
set resp.http.Access-Control-Allow-Methods = "GET, POST, PATCH, OPTIONS";
set resp.http.Access-Control-Allow-Headers = "Origin, Accept, Content-Type, X-Requested-With, X-CSRF-Token, Authorization, Access-Control-Allow-Origin, Access-Control-Allow-Credentials";
}
}
# More in https://www.w3.org/TR/2020/SPSD-cors-20200602/#syntax
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment