Last active
May 23, 2018 14:32
-
-
Save lukebussey/c3541d0fb9761af44fbd15c663d1b167 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
sub vcl_recv { | |
if (req.http.host == "domain.com" && req.url.path == "/user") { | |
error 601 "user"; | |
} | |
} | |
sub vcl_error { | |
if (obj.status == 601) { | |
set obj.http.Content-Type = "text/json"; | |
set obj.status = 200; | |
if (req.http.Origin ~ "localhost|domain\.com") { | |
set obj.http.Access-Control-Allow-Origin = req.http.Origin; | |
set obj.http.Access-Control-Allow-Credentials = "true"; | |
synthetic {"{ | |
"country": ""} client.geo.country_code {"""} if (<UserId>, {", | |
"identifier": ""} regsub(digest.hmac_sha256("<KEY>", <UserId>), "^0x","") {"""}, "") {" | |
}"}; | |
} else { | |
synthetic {"{}"}; | |
} | |
return(deliver); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment