This site is not affiliated with or endorsed by Cloudflare, Inc. It simply showcases experiments built using Cloudflare services.
Cloudflare Experiments

Smart Placement Probe

Demonstrate Workers Smart Placement by probing origin latency from the colo

Demonstrate Workers Smart Placement by fetching an origin URL and reporting latency alongside the request colo. wrangler.json sets "placement": { "mode": "smart" } so Cloudflare can place the Worker closer to back-end origins based on traffic patterns.

API Reference

GET /

Explains Smart Placement and returns app metadata.

GET /probe

Fetch a URL and report status, latency, and colo.

url string (required)

http:// or https:// target.

Example Request

curl "https://your-worker.workers.dev/probe?url=https://example.com"

Success Response

{
  "url": "https://example.com/",
  "status": 200,
  "latencyMs": 42,
  "cf": { "colo": "SJC" },
  "workerPlacement": "Smart Placement may move this Worker closer to back-end origins based on request patterns."
}

cf.colo comes from the incoming request.cf when available (empty object in local dev).

Error Codes

  • 400 - Missing or non-http(s) url (INVALID_URL)

Use Cases

  • Learn Smart Placement configuration and behavior
  • Measure origin latency from the serving colo
  • Compare placement effects after repeated traffic to distant origins
  • Debug whether a Worker is running near your back-end

Limitations

  • Smart Placement effects are most visible after deploy with repeated traffic
  • Single PoP / colo per request - not a multi-region map
  • cf.colo may be empty in local wrangler dev
  • No control plane API to force a specific colo

Deployment

Click the deploy button

Deploy to Cloudflare Workers

Deploy

No extra bindings - placement.mode: "smart" is already set in wrangler.json.

Test your deployment

curl "https://your-worker.workers.dev/probe?url=https://example.com"

Local Development

cd apps/experiments/smart-placement-probe
npm install
npm run dev
curl "http://localhost:8787/probe?url=https://example.com"

Smart Placement behavior is most visible after deploy with repeated requests to distant origins.

Cloudflare Features Used

On this page