VCL snippet fastly

There are multiple ways to achieve this, I would recommend the following (2 snippets):
 
Snippet type recv
 
if (req.url.path == "/.well-known/apple-developer-merchantid-domain-association.txt") {
error 618 "redirect";
}
 
Snippet type error
 
if (obj.status == 618 && obj.response == "redirect") {
set obj.status = 308;
set obj.http.Location = "https://" + req.http.host + "/media/.well-known/apple-developer-merchantid-domain-association.txt" + if (std.strlen(req.url.qs) > 0, "?" req.url.qs, "");
return (deliver);

}  


Ref. https://developer.fastly.com/solutions/tutorials/redirects/


if(req.url.path == "/.well-known/apple-developer-merchantid-domain-association.txt" ){
set req.url = "/media/.well-known/apple-developer-merchantid-domain-association.txt";
return(restart);
}

Comments