Prompt Buddy logoPrompt Buddy

cloudflare · Cloudflare Workers Docs

Workers Redirect

Implementation patterns for using Cloudflare Workers to redirect traffic either from a single URL to another or from one domain to a different domain.

Import to Prompt Buddy

Derived skill

Files assembled from official documentation

Viewing SKILL.md

Workers Redirect

Implementation patterns for using Cloudflare Workers to redirect traffic either from a single URL to another or from one domain to a different domain.

When To Use

Use when you need to implement URL redirection or domain migration logic using Cloudflare Workers code.

Reference Files

FileContainsUse For
SKILL.mdEntry point: scope, routing table, and workflow.Start here.
docs/workers-examples-redirect-workflow-guide.mdMarkdown documentation providing various implementation patterns for redirecting requests using Cloudflare Workers.Questions about markdown documentation providing various implementation patterns for redirecting requests using Cloudflare Workers.
examples/workers-examples-redirect-cloudflare-workers-redirect.textA JavaScript code example demonstrating how to use the Response.redirect method within a Cloudflare Worker to perform a URL redirect.Exact payloads, commands, or snippets shown in A JavaScript code example demonstrating how to use the Response.redirect method within a Cloudflare Worker to perform...
examples/workers-examples-redirect-cloudflare-workers-redirect-2.textA JavaScript code example demonstrating how to use the Response.redirect method within a Cloudflare Worker to perform a URL redirect.Exact payloads, commands, or snippets shown in A JavaScript code example demonstrating how to use the Response.redirect method within a Cloudflare Worker to perform...
examples/workers-examples-redirect-cloudflare-workers-python-redirect.textA Python implementation of a Cloudflare Worker that performs a 301 permanent redirect to a specified destination URL.Exact payloads, commands, or snippets shown in A Python implementation of a Cloudflare Worker that performs a 301 permanent redirect to a specified destination URL.
examples/workers-examples-redirect-cloudflare-workers-rust-redirect.textA Rust implementation of a Cloudflare Worker that performs a URL redirect with a specific HTTP status code.Exact payloads, commands, or snippets shown in A Rust implementation of a Cloudflare Worker that performs a URL redirect with a specific HTTP status code.
examples/workers-examples-redirect-cloudflare-workers-hono-redirect.textA Hono framework implementation for a Cloudflare Worker that performs a 301 redirect to a specified destination URL.Exact payloads, commands, or snippets shown in A Hono framework implementation for a Cloudflare Worker that performs a 301 redirect to a specified destination URL.
examples/workers-examples-redirect-cloudflare-workers-redirect-3.textA JavaScript code example demonstrating how to use the Response.redirect method within a Cloudflare Worker to redirect requests to a new destination URL.Exact payloads, commands, or snippets shown in A JavaScript code example demonstrating how to use the Response.redirect method within a Cloudflare Worker to redirec...
examples/workers-examples-redirect-cloudflare-workers-redirect-4.textA JavaScript implementation of a Cloudflare Worker that performs a 301 permanent redirect using the Response.redirect method.Exact payloads, commands, or snippets shown in A JavaScript implementation of a Cloudflare Worker that performs a 301 permanent redirect using the Response.redirect...
examples/workers-examples-redirect-cloudflare-workers-python-redirect-2.textA Python implementation of a Cloudflare Worker that parses an incoming request URL and returns a 301 redirect to a new base domain.Exact payloads, commands, or snippets shown in A Python implementation of a Cloudflare Worker that parses an incoming request URL and returns a 301 redirect to a ne...
examples/workers-examples-redirect-cloudflare-workers-rust-redirect-2.textA Rust implementation of a Cloudflare Worker that performs URL redirection using the worker crate.Exact payloads, commands, or snippets shown in A Rust implementation of a Cloudflare Worker that performs URL redirection using the worker crate.
examples/workers-examples-redirect-cloudflare-workers-hono-redirect-2.textA Hono framework implementation for a Cloudflare Worker that performs URL redirection using a 301 status code.Exact payloads, commands, or snippets shown in A Hono framework implementation for a Cloudflare Worker that performs URL redirection using a 301 status code.

What This Skill Covers

  • Redirect requests from one URL to another or from one set of URLs to another set.
  • Main sections: Tags, Redirect all requests to one URL, Redirect requests from one domain to another.

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/redirect