Cloudflare — Forward AI traffic

Cloudflare's Redirect Rules support UA-based matching on every plan,
including free.

Add the rule

  1. Cloudflare dashboard → your zone → Rules → Redirect Rules → Create rule.
  2. Configure:

When incoming requests match…

FieldOperatorValue
User Agentmatches regexthe AI-bot regex (copy from the MCP page card)

Then…

FieldValue
TypeStatic
URLhttps://oasy.<your-domain>
Status code302
Preserve query stringOff
  1. Deploy.

Verify

Back on the MCP page, click Check forwarding.

Test yourself

curl -I -A "ClaudeBot/1.0" https://your-domain.com/
# → HTTP/2 302
# → location: https://oasy.your-domain.com

If you're on Cloudflare Workers

You can also do this in a Worker — cheaper at high traffic and lets you
add custom logging:

const BOTS = /ChatGPT-User|PerplexityBot|GPTBot|ClaudeBot|.../i;

export default {
  async fetch(request, env) {
    const ua = request.headers.get('user-agent') ?? '';
    if (BOTS.test(ua)) {
      return Response.redirect(`https://oasy.${env.DOMAIN}`, 302);
    }
    return fetch(request);
  },
};

Add the Worker route to your-domain.com/* and you're done.

Common gotchas

  • "Bot Fight Mode" can interfere — Cloudflare may serve a challenge to
    some AI UAs before your Redirect Rule fires. Either whitelist the bots
    there or move this rule to a Worker (above) which runs first.
  • AMP / mobile redirects — if you already have other Redirect Rules,
    order matters. Put this one above any rules that strip query strings
    or rewrite hostnames.