Prompt Buddy logoPrompt Buddy

cloudflare · Cloudflare Workers Docs

Workers Conditional response

Implements logic to return different HTTP responses based on request attributes such as URL, HTTP method, User Agent, IP address, ASN, or device type within a Cloudflare Worker.

Import to Prompt Buddy

Derived skill

Files assembled from official documentation

Viewing SKILL.md

Workers Conditional response

Implements logic to return different HTTP responses based on request attributes such as URL, HTTP method, User Agent, IP address, ASN, or device type within a Cloudflare Worker.

When To Use

Use when you need to route requests or modify responses based on specific client metadata like device type, IP address, or HTTP methods.

Reference Files

FileContainsUse For
SKILL.mdEntry point: scope, routing table, and workflow.Start here.
docs/workers-examples-conditional-response-workflow-guide.mdA JavaScript example demonstrating how to return different HTTP responses based on request properties like URL, method, User Agent, and IP address in a Cloudflare Worker.Questions about a JavaScript example demonstrating how to return different HTTP responses based on request properties like URL, metho...
examples/workers-examples-conditional-response-cloudflare-workers-conditional-res.textA JavaScript example demonstrating how to return different HTTP responses based on request hostname and URL path patterns in a Cloudflare Worker.Exact payloads, commands, or snippets shown in A JavaScript example demonstrating how to return different HTTP responses based on request hostname and URL path patt...
examples/workers-examples-conditional-response-cloudflare-workers-conditional-res-2.textA JavaScript example demonstrating how to return different HTTP responses based on request hostname and URL patterns in a Cloudflare Worker.Exact payloads, commands, or snippets shown in A JavaScript example demonstrating how to return different HTTP responses based on request hostname and URL patterns...
examples/workers-examples-conditional-response-cloudflare-workers-python-conditio.textA Python implementation for a Cloudflare Worker that returns different HTTP responses based on the request hostname or URL path.Exact payloads, commands, or snippets shown in A Python implementation for a Cloudflare Worker that returns different HTTP responses based on the request hostname o...
examples/workers-examples-conditional-response-cloudflare-workers-hono-conditiona.textA Hono middleware implementation for Cloudflare Workers that returns conditional responses based on a list of blocked hostnames.Exact payloads, commands, or snippets shown in A Hono middleware implementation for Cloudflare Workers that returns conditional responses based on a list of blocked...

What This Skill Covers

  • Return a response based on the incoming request's URL, HTTP method, User Agent, IP address, ASN or device type.
  • 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/conditional-response