Prompt Buddy logoPrompt Buddy

cloudflare · Cloudflare Workers Docs

Workers Country code redirect

Implements a Cloudflare Worker to detect a visitor's country via request headers and perform a redirect based on that geolocation data.

Import to Prompt Buddy

Derived skill

Files assembled from official documentation

Viewing SKILL.md

Workers Country code redirect

Implements a Cloudflare Worker to detect a visitor's country via request headers and perform a redirect based on that geolocation data.

When To Use

Use when you need to implement automated URL redirection based on the geographic location of a user's request.

Reference Files

FileContainsUse For
SKILL.mdEntry point: scope, routing table, and workflow.Start here.
docs/workers-examples-country-redirect-workflow-guide.mdA Cloudflare Workers example demonstrating how to redirect visitors based on the country code provided in the request headers.Questions about a Cloudflare Workers example demonstrating how to redirect visitors based on the country code provided in the request...
examples/workers-examples-country-redirect-cloudflare-workers-country-redirect-ja.textA Cloudflare Worker script that uses the request country property to redirect users to localized URLs based on a mapping object.Exact payloads, commands, or snippets shown in A Cloudflare Worker script that uses the request country property to redirect users to localized URLs based on a mapp...
examples/workers-examples-country-redirect-cloudflare-workers-country-redirect-ja-2.textA Cloudflare Worker script that uses the request country property to redirect users to localized URLs based on a mapping object.Exact payloads, commands, or snippets shown in A Cloudflare Worker script that uses the request country property to redirect users to localized URLs based on a mapp...
examples/workers-examples-country-redirect-cloudflare-workers-country-redirect-py.textA Python Cloudflare Worker script that uses the cf object to redirect incoming requests to region-specific URLs based on the visitor's country code.Exact payloads, commands, or snippets shown in A Python Cloudflare Worker script that uses the cf object to redirect incoming requests to region-specific URLs based...
examples/workers-examples-country-redirect-cloudflare-workers-hono-country-redire.textA Hono-based Cloudflare Worker script that maps visitor country codes to specific localized URLs.Exact payloads, commands, or snippets shown in A Hono-based Cloudflare Worker script that maps visitor country codes to specific localized URLs.

What This Skill Covers

  • Redirect a response based on the country code in the header of a visitor.
  • Main sections: Tags.

Workflow

  1. Open the most relevant file under docs/ for the exact documented workflow and wording.
  2. Open schemas/ files for exact structured contracts.
  3. Open examples/ files for concrete requests, commands, snippets, and manifests.
  4. Do not add behavior or configuration that is not present in the attached source files.

Canonical source: https://developers.cloudflare.com/workers/examples/country-code-redirect