Last active
September 4, 2017 13:46
-
-
Save KlavsKlavsen/fa76b1b40bbb700a3e55a60db6baf08a to your computer and use it in GitHub Desktop.
varnish - OPTIONS response
This file contains 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
#compose own OPTIONS reponse | |
vcl_recv { | |
if (req.method == "OPTIONS") { | |
return(synth(750, "Options")); | |
} | |
} | |
sub vcl_synth { | |
if (resp.status == 750) { | |
#set resp.http.Access-Control-Allow-Origin = "*"; | |
set resp.http.Access-Control-Allow-Origin = req.http.Origin; | |
set resp.http.Access-Control-Allow-Credentials = "true"; | |
set resp.http.Access-Control-Max-Age = "1728000"; | |
set resp.http.Access-Control-Allow-Methods = "GET, POST, PUT, DELETE, PATCH, OPTIONS"; | |
set resp.http.Access-Control-Allow-Headers = "Content-Type, x-requested-with, x-api-key, x-yspro, x-password, x-authorization, x-app-version"; | |
set resp.http.Content-Length = "0"; | |
set resp.http.Content-Type = "text/plain charset=UTF-8"; | |
set resp.status = 204; | |
return(deliver); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment