circle-info
Version 2 is coming up

Fastly

Overview

This documentation describes a Fastly Compute@Edge implementation that detects traffic from AI search engines and agentic web crawlers using User-Agent analysis. The function routes AI systems to machine-optimized endpoints, improving how your content is consumed, interpreted, and referenced across the agentic web.

Architecture

Incoming Request → User-Agent Analysis → AI Bot Detection → Routing Decision → URL Rewrite

Key Components

  • AI Bot Detection Engine

  • Routing Logic

  • Configuration Management

  • Logging & Observability

AI Search Engine Bot Detection

Introduction

This implementation identifies traffic from AI search engines and agentic web crawlers such as ChatGPT, Perplexity, Gemini, Claude, Grok, and DeepSeek. The system routes these agents to specialized endpoints optimized for AI consumption, improving machine readability, model context accuracy, and your overall presence across the agentic web.

Configuration

AI Bot Pattern Configuration (config.json)

Routing Rules Configuration (routing.json)

Implementation

aiDetection.ts

routing.ts

main.ts (Fastly Compute@Edge)

Routing Methods

Path Prefix Routing

/docs/intro/chatgpt/docs/intro

Subdomain Routing

example.com/pageclaude.example.com/page

Parameter Routing

/guide/guide?ai=perplexity

Monitoring & Analytics

Headers

  • X-AI-Bot

  • X-Original-URL

  • X-AI-Optimized

Log Format

Deployment

  1. Add files to your Compute@Edge project

  2. Build the package

  3. Upload & activate your service

  4. Verify routing in staging

  5. Deploy to production

That’s it! You have now successfully configured Limy router for your website. Data should begin to populate on your dashboard within an hour.

Last updated