cloudflare · Cloudflare Workers Docs
Workers Rewrite links
Implements a Cloudflare Worker using the HTMLRewriter API to programmatically modify URL links within HTML content.
Derived skill
Files assembled from official documentation
Viewing SKILL.md
Workers Rewrite links
Implements a Cloudflare Worker using the HTMLRewriter API to programmatically modify URL links within HTML content.
When To Use
Use when you need to programmatically intercept and modify URL paths within HTML responses using Cloudflare Workers.
Reference Files
| File | Contains | Use For |
|---|---|---|
SKILL.md | Entry point: scope, routing table, and workflow. | Start here. |
docs/workers-examples-rewrite-links-workflow-guide.md | A markdown guide demonstrating how to use the HTMLRewriter API in Cloudflare Workers to rewrite URL links within HTML content. | Questions about a markdown guide demonstrating how to use the HTMLRewriter API in Cloudflare Workers to rewrite URL links within HTML... |
examples/workers-examples-rewrite-links-cloudflare-workers-rewrite-links.text | A JavaScript implementation of a Cloudflare Worker that uses the HTMLRewriter API to replace domain names within link attributes. | Exact payloads, commands, or snippets shown in A JavaScript implementation of a Cloudflare Worker that uses the HTMLRewriter API to replace domain names within link... |
examples/workers-examples-rewrite-links-cloudflare-workers-rewrite-links-javascri.text | A JavaScript implementation of a Cloudflare Worker that uses the HTMLRewriter API to replace specific domain links in HTML responses. | Exact payloads, commands, or snippets shown in A JavaScript implementation of a Cloudflare Worker that uses the HTMLRewriter API to replace specific domain links in... |
examples/workers-examples-rewrite-links-cloudflare-workers-python-htmlrewriter-li.text | A Python implementation using HTMLRewriter to intercept and modify URL attributes within HTML elements. | Exact payloads, commands, or snippets shown in A Python implementation using HTMLRewriter to intercept and modify URL attributes within HTML elements. |
examples/workers-examples-rewrite-links-cloudflare-workers-hono-rewrite-links.text | A Hono-based Cloudflare Worker example that uses an AttributeRewriter class to replace domain names within HTML attributes. | Exact payloads, commands, or snippets shown in A Hono-based Cloudflare Worker example that uses an AttributeRewriter class to replace domain names within HTML attri... |
What This Skill Covers
- Rewrite URL links in HTML using the HTMLRewriter. This is useful for JAMstack websites.
- Main sections:
Tags.
Workflow
- Open the most relevant file under
docs/for the exact documented workflow and wording. - Open
schemas/files for exact structured contracts. - Open
examples/files for concrete requests, commands, snippets, and manifests. - Do not add behavior or configuration that is not present in the attached source files.
Canonical source: https://developers.cloudflare.com/workers/examples/rewrite-links
