Fastly — Forward AI traffic
Fastly does this in custom VCL. Add a recv snippet to your service.
VCL snippet
sub vcl_recv {
#FASTLY recv
if (req.http.User-Agent ~ "(?i)(ChatGPT-User|PerplexityBot|Perplexity-User|GPTBot|OAI-SearchBot|anthropic-ai|Claude-Web|ClaudeBot|Claude-User|Google-Extended|Gemini|Applebot-Extended|meta-externalagent|meta-externalfetcher|CCBot|cohere-ai|YouBot|Diffbot|Timpibot|Amazonbot|Bytespider)") {
error 902 "ai-forward";
}
}
sub vcl_error {
if (obj.status == 902) {
set obj.status = 302;
set obj.response = "Found";
set obj.http.Location = "https://oasy.<your-domain>";
set obj.http.Cache-Control = "no-store";
synthetic "";
return (deliver);
}
}Replace <your-domain> with your domain. Save, then Activate the
new version.
Verify
Back on the MCP page, click Check forwarding.
Test yourself
curl -I -A "GPTBot/1.2" https://your-domain.com/
# → HTTP/2 302
# → location: https://oasy.your-domain.comNotes
- We use the
error 902 → vcl_errorpattern so the redirect happens before
cache lookup. No bot request ever touches your origin. - If you want to log these for auditing, add
set req.http.X-AI-Bot = "1";
inside theifand tee it into your existing access log line item. - Compute@Edge (the JS-based replacement) does the same thing in ~10 lines
of JS — happy to provide a sample if you'd rather, ping us.