Big picture
One request, from DNS to your origin, and what the edge decides on the way
Rumbo tracks shipments. Its origin is a Spring Boot API with PostgreSQL; in front of it, one Worker on the edge of Cloudflare, with its bindings. This picture puts every piece of the course on one scene.
Pick a journey: the dot is the request or the message, and its letters are what it carries. Each stop says what is decided at that piece and which lesson goes deeper. Click any piece for its card: what it is, what it is for, what it does not do, the free plan and the kit. An area has a card too.
Tags say how to see a stop yourself: LAB in the kit, with no account; ACCOUNT with a free Cloudflare account, optional; ZONE with a domain of your own, shown by the lessons as a case study; MODEL only in the lessons.
A · Through the edge
DNS, anycast, the stages, the Worker, the origin
- Shop app: The lab plays a client of the API: GET /api/shipments/R-1042, to the edge of the kit on 127.0.0.1:18097. What the dot carries: Request. Lab Lesson 00 · Before you start
docker compose run --rm lab get /api/shipments/R-1042 - DNS [proxied]: On Cloudflare the hostname is a proxied record: DNS answers with anycast addresses of Cloudflare, not with the address of the origin. What the dot carries: Request. Lab Lesson 02 · DNS with or without the proxy
docker compose run --rm lab dns www.cloudflare.com - Anycast [colo]: The same addresses are announced from every data center, and routing takes the request to one, usually nearby. /cdn-cgi/trace names it in colo. What the dot carries: Request. Lab Lesson 01 · A request goes through the edge
docker compose run --rm lab trace - TLS: Leg 1 ends here, with a certificate Cloudflare manages for the zone. The encryption mode of the zone decides how leg 2 reaches the origin. What the dot carries: Request. Zone Lesson 03 · TLS in two legs
- WAF: Custom, rate limiting and managed rules run in fixed phases. Nothing matches, so the request goes on. What the dot carries: Request. Zone Lesson 13 · WAF: rules on the request
- Cache [no-store]: No Access policy on this hostname. The API answers no-store, so no cache on the way may keep it. What the dot carries: Request. Lab Lesson 10 · What the edge keeps
- Worker: The gateway of Rumbo, in a V8 isolate. The admin API would be refused here; this route goes on. What the dot carries: Request. Lab Lesson 07 · A Worker in front of your API
- Rate limit [within budget]: The budget of the key: 5 requests every 10 seconds. Without an x-api-key, every client shares the anonymous one. Lab Lesson 14 · Rate limiting
- cloudflared, Tunnel: In production the request reaches the origin through connections cloudflared opened from inside. In the kit the Worker calls origin:8080 on the Compose network. What the dot carries: Request. Zone Lesson 04 · An origin with no open ports
- API of Rumbo [x-rumbo-edge]: The origin sees x-rumbo-edge and x-rumbo-request-id, added by the Worker. Called directly, with lab origin /echo, it sees neither. What the dot carries: Request. Lab Lesson 01 · A request goes through the edge
docker compose run --rm lab get /echo - Worker: On the way out the Worker adds x-rumbo-via: edge. After the answer, ctx.waitUntil records the last request in KV without making the client wait. What the dot carries: Response. Lab Lesson 07 · A Worker in front of your API
docker compose run --rm lab get /lab/last-request - TLS [cf-ray]: Back over leg 1. A site behind Cloudflare answers with server: cloudflare and a cf-ray, the Ray ID of the request. What the dot carries: Response. Lab Lesson 01 · A request goes through the edge
docker compose run --rm lab headers
End of the journey: Every request meets the edge first, in the data center where it arrived: TLS, the rules, the cache and the Worker decide before the origin is called, and each leaves something you can read in a header.
B · Around the edge
a DNS-only record, an open port, a tunnel
- Someone else: Someone nobody invited: a bot, an attack, or a person who found the address of the origin. What the dot carries: Request. Model Lesson 02 · DNS with or without the proxy
- DNS only [real address]: An old DNS-only record leaks it: Cloudflare answers with the real address, and requests go straight to that server, with no cache, no WAF and no Worker on the way. What the dot carries: Request. Lab Lesson 02 · DNS with or without the proxy
docker compose run --rm lab dns github.com - Open port [no edge]: If the origin still listens on a public port, this path never meets the edge. A tunnel adds a way in; it does not close the others. What the dot carries: Request. Model Lesson 04 · An origin with no open ports
- API of Rumbo [401]: The origin still asks for proof: its panel validates the token itself, so skipping the edge does not skip the check. What the dot carries: Request. Lab Lesson 15 · Access: identity before the origin
docker compose run --rm lab panel --direct - API of Rumbo [:0]: In the kit the origin publishes no port: port 8080 has no address on your machine. Only the edge does. Lab Lesson 04 · An origin with no open ports
docker compose port origin 8080 - cloudflared, Tunnel: A way in from the inside: cloudflared, next to the service, opens outbound connections to Cloudflare, and the edge sends the requests for the hostname through them. Lab Lesson 04 · An origin with no open ports
docker compose --profile tunnel up -d tunnel - cloudflared, Tunnel [trycloudflare.com]: A quick tunnel, with no account: a trycloudflare.com name answers with server: cloudflare and the body of rumbo-origin. In the validation runs it took 14 to 41 seconds. Lab Lesson 04 · An origin with no open ports
docker compose run --rm lab tunnel - cloudflared, Tunnel [outbound]: Registered tunnel connection: an outbound connection to a data center. A named tunnel keeps four, to two data centers, and survives restarts. Lab Lesson 04 · An origin with no open ports
docker compose logs tunnel
End of the journey: The proxy hides the origin in DNS only. With no open port and an origin that checks who calls, finding its address is not enough.
C · TLS in two legs
the padlock covers leg 1; the mode decides leg 2
- TLS: Leg 1, from the visitor to the edge, with a certificate Cloudflare manages for the zone. The padlock says nothing about leg 2. What the dot carries: Request. Zone Lesson 03 · TLS in two legs
- TLS: Leg 2 depends on the encryption mode of the zone: Off, Flexible, Full, Full (strict) or Strict. lab tls plays the edge on that leg; an impostor answers with a self-signed certificate for the same name. Lab Lesson 03 · TLS in two legs
docker compose --profile tls up -d --wait impostor - API of Rumbo [plain HTTP]: Flexible: leg 2 in plain HTTP. Whoever sits between the edge and the origin can read and change it. What the dot carries: Request. Lab Lesson 03 · TLS in two legs
docker compose run --rm lab tls flexible - API of Rumbo [impostor accepted]: Full: HTTPS without validating the certificate. A self-signed one is accepted, and so is any server that answers with one: encrypted, to the wrong server. Lab Lesson 03 · TLS in two legs
docker compose run --rm lab tls full impostor - API of Rumbo [accepted]: Full (strict) validates the certificate of the origin, signed by the test CA of the kit, which stands for the authorities it trusts. Lab Lesson 03 · TLS in two legs
docker compose run --rm lab tls strict origin - API of Rumbo [rejected]: The impostor under strict: rejected, DEPTH_ZERO_SELF_SIGNED_CERT. The name was right; nobody trusted signed it. Lab Lesson 03 · TLS in two legs
docker compose run --rm lab tls strict impostor
End of the journey: Encrypted is not enough: leg 2 must also check who answers. Full (strict) validates the certificate of the origin; Full accepts any.
D · A Worker in front
configuration, isolates, decisions before the origin, tests
- Wrangler: wrangler.jsonc names the Worker, its entry point, its compatibility date and nine bindings: COUNTERS, DB, FLAGS, LIMITER, MOVES, PG, PROOFS, RETURNS and SHIPMENTS. Lab Lesson 06 · Wrangler and the configuration
docker compose run --rm lab config - Worker [set, 16 characters]: vars are committed with the code; secrets go to the account, and locally to .dev.vars, read when wrangler dev starts. The lab prints only the length. Lab Lesson 06 · Wrangler and the configuration
docker compose exec edge sh -c "echo RUMBO_TOKEN=local-only-value > .dev.vars" - Worker [same id, hits + 1]: A V8 isolate inside a runtime that already runs: a module variable survives some requests. Restart the edge and the id changes: global state is not yours to keep. Lab Lesson 05 · An isolate, not a container
docker compose run --rm lab isolate - Worker [204, shop.example]: A CORS preflight is answered at the edge, only for the shop that is allowed. Lab Lesson 07 · A Worker in front of your API
docker compose run --rm lab options /api/shipments/R-1042 https://shop.example - Worker [no allow-origin]: For another page there is no access-control-allow-origin: a browser there will not let its script read the answer. Lab Lesson 07 · A Worker in front of your API
docker compose run --rm lab options /api/shipments/R-1042 https://other.example - Worker [403]: The admin API is refused at the edge: the origin gets no load from it and never sees it. Lab Lesson 07 · A Worker in front of your API
docker compose run --rm lab get /api/admin/users - KV: After an answer, ctx.waitUntil keeps working for up to 30 seconds: the gateway records the last request in KV. The refused and the preflight requests never got that far. What the dot carries: Flag. Lab Lesson 07 · A Worker in front of your API
docker compose run --rm lab get /lab/last-request - The kit [6 passed]: Tests run inside workerd with the bindings simulated: health, the admin API, CORS, maintenance, the forward to the origin and the 502 of a dead origin. Lab Lesson 08 · Testing a Worker
docker compose exec edge npx vitest run - The kit: The origin is not part of the test: vi.spyOn replaces the global fetch, to answer as the origin would or to fail as a dead one. Lab Lesson 08 · Testing a Worker
docker compose exec edge grep -n "spyOn" test/gateway.test.ts
End of the journey: Each decision taken at the edge is one the origin does not have to take, and one it cannot get wrong. Global state is not yours to keep, and the tests run in the same runtime.
E · Deploy and versions
upload, deploy, a gradual split
- The kit [1.50 KiB]: A second Worker, rumbo-edge-demo, with no bindings so it fits the free plan: --dry-run builds it and stops. Lab Lesson 09 · Deploy and observe
docker compose exec edge npx wrangler deploy --dry-run --config deploy/wrangler.jsonc - Wrangler [token: active]: With labs/.env, your account id and a token that can edit Workers. Optional, and never printed. Account Lesson 09 · Deploy and observe
docker compose run --rm lab account - Worker [v1 at 100%]: wrangler deploy uploads a version and deploys it to 100%: the Worker answers on workers.dev, with no zone of your own. Account Lesson 09 · Deploy and observe
docker compose run --rm lab wrangler deploy --tag v1 - Worker [v2 not deployed]: versions upload keeps a new version without serving it. A deployment can use only the last 100 uploaded versions. Account Lesson 09 · Deploy and observe
docker compose run --rm lab wrangler versions upload --tag v2 --var VERSION:v2 - Worker [90% and 10%]: versions deploy splits the traffic by percentage. Running it again moves the split, or rolls back. Account Lesson 09 · Deploy and observe
docker compose run --rm lab wrangler versions deploy --version-tag v1@90% --version-tag v2@10% -y - TLS [mostly v1]: Each request is routed on its own: most get v1, a few v2, and one user can see both, unless version affinity keeps a key on one. Account Lesson 09 · Deploy and observe
docker compose run --rm lab split /version 40
End of the journey: A version is code and configuration, kept; a deployment says which versions serve requests and in what share. Moving the split is how you roll forward or back.
F · What the edge keeps
Cache-Control, a HIT, the key trap, the Cache API
- Browser: A customer opens the public tracking page, GET /track/R-1042: the same page for everyone who follows that shipment. What the dot carries: Request. Lab Lesson 10 · What the edge keeps
docker compose run --rm lab get /track/R-1042 - Worker [max-age=60, public]: The page answers cache-control: max-age=60, public: the same for everyone, safe to share for a minute. A zone would not keep it by default, because it is HTML; Workers Cache would. What the dot carries: Response. Lab Lesson 10 · What the edge keeps
- Cache [MISS, then HIT]: Workers Cache sits in front of the Worker and follows the Cache-Control of its answers: MISS, then HIT. A HIT does not run the Worker, so it uses no CPU, though it still counts as a request. wrangler dev does not run it, so this needs an account. What the dot carries: Stored copy. Account Lesson 10 · What the edge keeps
docker compose run --rm lab remote /c/public 2 - Cache [no HIT]: private, no-store or a Set-Cookie: nothing is kept. A 200 with no Cache-Control is kept by heuristic, for up to two hours. Account Lesson 10 · What the edge keeps
docker compose run --rm lab remote /c/cookie 2 - Worker: A profile is personal, but this route marks it public, and the cache key is the URL: it does not include the user. Ana's profile is now stored. What the dot carries: Response. Lab Lesson 11 · The cache key and its traps
docker compose run --rm lab get /lab/cache/profile -H x-user:ana - Cache API [Beto got Ana]: Beto asks for the same URL and gets the stored entry: Ana's profile, with her address. The kit plays the trap with the Cache API; the cache of a zone falls into it the same way. What the dot carries: Stored copy. Lab Lesson 11 · The cache key and its traps
docker compose run --rm lab get /lab/cache/profile -H x-user:beto - Cache API [his own answer]: profile-safe answers private, no-store: nothing is kept, and each person gets their own answer. Lab Lesson 11 · The cache key and its traps
docker compose run --rm lab get /lab/cache/profile-safe -H x-user:beto - Cache API [HIT]: caches.default from the Worker: match, put and delete, under a key it chooses. The rate of a zone is kept for 60 seconds. What the dot carries: Stored copy. Lab Lesson 12 · Cache from a Worker
docker compose run --rm lab get "/lab/cache/rate?zone=dub" - Cache API [this data center only]: delete purges only this data center: the Cache API does not replicate. To reach every data center, purge the zone, or Workers Cache by tag. Lab Lesson 12 · Cache from a Worker
docker compose run --rm lab get "/lab/cache/purge?zone=dub"
End of the journey: The response decides what is kept: public only for what is the same for everyone, private or no-store for anything personal. Purging fixes the past; only a correct Cache-Control fixes the future.
G · Rules and budgets
a rule on the path, its case, a limit per key
- Shop app: GET /api/admin/users: a route no client should reach. What the dot carries: Request. Lab Lesson 13 · WAF: rules on the request
docker compose run --rm lab get /api/admin/users - WAF: On a zone, a custom rule starts_with(http.request.uri.path, "/api/admin") with Block ends the request here: later phases and the Worker never see it. Blocks are sampled as security events. What the dot carries: Request. Zone Lesson 13 · WAF: rules on the request
- Worker [403]: The kit has no zone, so the gateway plays the rule: 403 before the origin, answered by the Worker alone. Lab Lesson 13 · WAF: rules on the request
- Worker [404 from the origin]: /API/admin/users passes: the rule compares exact text, case included, and Spring Boot answers 404. A WAF expression that ignores case uses lower(http.request.uri.path). Lab Lesson 13 · WAF: rules on the request
docker compose run --rm lab get /API/admin/users - Rate limit [200 five times, then 429]: A budget per x-api-key: 5 requests every 10 seconds. k1 gets five 200s, then 429 with retry-after: 10. Lab Lesson 14 · Rate limiting
docker compose run --rm lab limit k1 - Rate limit [its own budget]: k2 has its own budget. The counts are per location and eventually consistent: approximate, not exact. Lab Lesson 14 · Rate limiting
docker compose run --rm lab limit k2 3 - WAF: A rate limiting rule of the WAF runs in its own phase, before any Worker; the free plan includes one. The binding knows what a rule cannot, such as the tenant behind a key. Zone Lesson 14 · Rate limiting
End of the journey: A rule in the zone runs before any Worker; a rule in code runs only where your Worker runs, and both compare text exactly as written. A budget per key counts what a rule of the zone cannot see.
H · Identity before the origin
Access, a signed JWT, an origin that validates it
- Employee: Ana, of operations, opens the internal panel, from home, with no VPN. What the dot carries: Request. Zone Lesson 15 · Access: identity before the origin
- Access [policy: allow]: Cloudflare Access asks who she is: she signs in with the identity provider, and a policy allows the people of operations. What the dot carries: Request. Zone Lesson 15 · Access: identity before the origin
- Access: The edge adds a signed JWT to the requests that pass: the Cf-Access-Jwt-Assertion header and the CF_Authorization cookie. What the dot carries: Request, Signed JWT. Zone Lesson 15 · Access: identity before the origin
- API of Rumbo [401]: The kit has no Access. Without a token, the origin asks for one. Lab Lesson 15 · Access: identity before the origin
docker compose run --rm lab panel - Worker [test issuer]: The edge of the kit serves a test issuer with its own ES256 key and the claims of Access: iss, aud rumbo-panel, Ana's email, and an expiry five minutes later. What the dot carries: Signed JWT. Lab Lesson 15 · Access: identity before the origin
docker compose run --rm lab token - API of Rumbo [200]: Spring Security, as a resource server, validates four things: the signature with the published keys, the audience, the issuer and the expiry. What the dot carries: Signed JWT. Lab Lesson 15 · Access: identity before the origin
docker compose run --rm lab panel --token - API of Rumbo [401]: A token of another application, expired or changed gets 401, and the reason: the audience, Jwt expired, Invalid signature. Lab Lesson 15 · Access: identity before the origin
docker compose run --rm lab panel --tampered - API of Rumbo [401]: Called directly, skipping the edge, the origin still asks for proof. With Access only three values change: the URL of the keys, the issuer and the audience. Lab Lesson 15 · Access: identity before the origin
docker compose run --rm lab panel --direct
End of the journey: Access checks who the person is at the edge; the origin validates the signed token itself. Reaching the origin another way does not skip the check.
I · A flag and a counter
KV reads fast; a Durable Object counts right
- KV: Workers KV keeps the maintenance flag of Rumbo: written to central stores, cached in the data centers that read it. What the dot carries: Flag. Lab Lesson 16 · KV: fast reads, eventual writes
docker compose exec edge npx wrangler kv key put maintenance on --binding FLAGS --local - Worker [503]: The gateway reads the flag: on, so it answers 503, maintenance, and the origin is not called. What the dot carries: Flag. Lab Lesson 16 · KV: fast reads, eventual writes
docker compose run --rm lab get /api/shipments/R-1042 - KV [200 again]: Delete it and the next request reaches the origin. Locally the change is seen at once; on Cloudflare, other data centers can take a minute or more. Lab Lesson 16 · KV: fast reads, eventual writes
docker compose exec edge npx wrangler kv key delete maintenance --binding FLAGS --local - KV [final: 1 of 50]: Not a counter: 50 requests read the same old number, add one and write it back. KV has no atomic operations, and most increments are lost. Lab Lesson 16 · KV: fast reads, eventual writes
docker compose run --rm lab race kv - Durable Object [final: 50]: A Durable Object per counter, through the binding COUNTERS, lives in one place and handles one call at a time: the 50 increments arrive one after the other. What the dot carries: Object state. Lab Lesson 19 · Durable Objects: one place per thing
docker compose run --rm lab race do - Durable Object [200 of 200]: Its storage is strongly consistent. One object is one place, though, with a soft limit near 1,000 requests a second: split the state into more objects for more load. Lab Lesson 19 · Durable Objects: one place per thing
docker compose run --rm lab race do 200 - Durable Object [exists when asked]: An object exists because it was asked for: shipment R-1043, no movements yet, nobody watching. Lab Lesson 19 · Durable Objects: one place per thing
docker compose run --rm lab get /shipments/R-1043/state
End of the journey: KV is for data read much more than written, and eventual. A counter needs one place that takes one call at a time: a Durable Object.
J · Data next to the Worker
D1 for quotes, R2 for proofs, Hyperdrive to Postgres
- Worker: The edge computes a shipping quote by itself, without asking the origin. What the dot carries: Request. Lab Lesson 17 · D1: SQLite at the edge
docker compose run --rm lab quote MAD 2.5 - D1 [16 EUR]: D1 is SQLite at the edge, with prepared statements and bind. Madrid, 2.5 kg: 12.0 + 1.6 x 2.5 = 16, stored as a new quote. Lab Lesson 17 · D1: SQLite at the edge
- D1 [no migrations to apply]: The schema changes with numbered migrations, recorded in d1_migrations: applying twice does nothing. Lab Lesson 17 · D1: SQLite at the edge
docker compose exec edge npx wrangler d1 migrations list rumbo-edge --local - R2 [201]: R2 keeps the proof of delivery as an object, proofs/R-1043.txt, with its etag. Bodies are streams: the Worker passes them on without loading them. Lab Lesson 18 · R2: objects without egress fees
docker compose run --rm lab proof put R-1043 signed by Ana - R2 [same etag]: Reading it out has no egress fee; storage and operations are what count. R-1044 has no proof: 404. Lab Lesson 18 · R2: objects without egress fees
docker compose run --rm lab proof get R-1043 - Hyperdrive: /direct reads the shipment from PostgreSQL through Hyperdrive, with an ordinary driver: Spring Boot is not involved. Lab Lesson 21 · Hyperdrive: your Postgres from the edge
docker compose run --rm lab get /direct/shipments/R-1044 - PostgreSQL 18 [3 rows]: The same database the origin uses. On Cloudflare, Hyperdrive pools connections near it and caches reads without invalidating them on writes; in the kit there is no pool and no cache. Lab Lesson 21 · Hyperdrive: your Postgres from the edge
docker compose exec db psql -U rumbo -d rumbo -c "SELECT id, status FROM shipments ORDER BY id" - API of Rumbo [servedBy rumbo-origin]: The same status through the origin: two paths to one database, and the edge chooses. Lab Lesson 21 · Hyperdrive: your Postgres from the edge
docker compose run --rm lab get /api/shipments/R-1044
End of the journey: Each store has its own guarantee: SQL with migrations in D1, objects with no egress fees in R2, and your own Postgres through Hyperdrive, without moving the data.
K · A carrier's webhook
202 at once, a queue, an idempotent consumer, an alarm
- Carrier: A carrier reports a movement: POST /webhooks/movement, event m-1, R-1042, delivered. What the dot carries: Request. Lab Lesson 22 · Queues: at least once
docker compose run --rm lab webhook m-1 R-1042 delivered - Worker [202]: The Worker sends the movement to the queue and answers 202 at once: the carrier does not wait for the work. What the dot carries: Movement. Lab Lesson 22 · Queues: at least once
- Queue: At least once. The kit delivers a batch every 2 seconds, with max_retries 2 and a dead letter queue, movements-dead. What the dot carries: Movement. Lab Lesson 22 · Queues: at least once
- Worker [attempts: 1]: The queue handler of the same Worker takes the batch and posts each movement to the origin. What the dot carries: Movement. Lab Lesson 22 · Queues: at least once
- API of Rumbo [saved]: The event id is the primary key of the movements table: saved once. What the dot carries: Movement. Lab Lesson 22 · Queues: at least once
- Durable Object: The object of shipment R-1042 takes the new status and pushes it over its WebSocket to the browsers watching it. What the dot carries: Object state. Lab Lesson 20 · Durable Objects over time
- API of Rumbo [already saved]: The same message twice: the origin answers already saved, and nothing changes. The consumer has to be idempotent. Lab Lesson 22 · Queues: at least once
docker compose run --rm lab webhook m-1 R-1042 delivered - Queue [dead letter queue]: A status the origin rejects with 422: retried, three attempts, then movements-dead, in about eight seconds. Lab Lesson 22 · Queues: at least once
docker compose run --rm lab webhook m-2 R-1042 lost in space - Durable Object [delayed: true]: No movement in 8 seconds: the alarm of the object marks the shipment delayed and tells its watchers. A final status, delivered, cancels the alarm. Lab Lesson 20 · Durable Objects over time
docker compose run --rm lab live R-1044
End of the journey: The carrier gets 202 at once and the work happens later, at least once. The event id makes a repeat harmless, a dead letter queue keeps what failed, and the object of the shipment notices silence.
L · A return that waits
steps that survive, a person, one retry
- Shop app: A return is requested for shipment R-1043: POST /returns/r-1. What the dot carries: Request. Lab Lesson 23 · Workflows: steps that survive
docker compose run --rm lab return start r-1 R-1043 - Worker: The Worker creates an instance of the Workflow of returns with the id r-1. What the dot carries: Request. Lab Lesson 23 · Workflows: steps that survive
- Workflow [running]: step.do stores the registration; step.waitForEvent waits for approved. While it waits, nothing runs and nothing is lost. What the dot carries: Return instance. Lab Lesson 23 · Workflows: steps that survive
- Workflow [running, output null]: Status running, output null: the instance waits for a person, for days if needed. Lab Lesson 23 · Workflows: steps that survive
docker compose run --rm lab return status r-1 - Workflow [refund: attempts 2]: Ana approves: an approved event with her name. The refund fails once on purpose, and only that step is retried. Lab Lesson 23 · Workflows: steps that survive
docker compose run --rm lab return approve r-1 ana - Workflow [complete]: Registered, refunded, approved by ana, notified: the output of every step is stored. What the dot carries: Return instance. Lab Lesson 23 · Workflows: steps that survive
- Worker [already_exists]: The same id again is refused: instance.already_exists. A duplicate request is harmless. Lab Lesson 23 · Workflows: steps that survive
docker compose run --rm lab return start r-1 R-1043
End of the journey: Each step of a Workflow stores its result, so waiting for a person or retrying a failed step loses nothing, and the id of an instance makes a repeated request harmless.
M · The close at 03:00
a Cron Trigger, Hyperdrive, KV
- Cron Trigger: A Cron Trigger, 0 3 * * *, in UTC: the daily close of Rumbo. After a change, the new schedule can take up to 15 minutes to reach the network. Lab Lesson 24 · Cron and platform events
docker compose exec edge grep -n "crons" wrangler.jsonc - Worker [scheduled: ok]: wrangler dev does not fire Cron Triggers by itself: lab cron asks the Local Explorer to run the scheduled handler. Lab Lesson 24 · Cron and platform events
docker compose exec edge lab cron - Hyperdrive: The handler reads the shipments by status from PostgreSQL, through Hyperdrive. Lab Lesson 24 · Cron and platform events
- PostgreSQL 18: Three shipments, counted by status. Lab Lesson 24 · Cron and platform events
- KV [close:last]: The close is stored in KV, under close:last. What the dot carries: Flag. Lab Lesson 24 · Cron and platform events
- Worker [ok]: The other way: /cdn-cgi/local/scheduled, with an optional cron and time. Both answer only on the address of the edge itself, so the lab runs them inside it. Lab Lesson 24 · Cron and platform events
docker compose exec edge curl -s "http://127.0.0.1:8787/cdn-cgi/local/scheduled?cron=0+3+*+*+*"
End of the journey: A Cron Trigger runs the scheduled handler of the Worker at a time in UTC, with the same bindings as a request. Locally you run it by hand.
N · An edge you can defend
what is cached, what protects what, what each store guarantees
- Cache: What is cached, and why: the public page max-age=60, the API no-store, a profile private, the rate of a zone in the Cache API of each data center. Lab Lesson 25 · An edge you can defend
- Worker [403]: The admin API is refused at the edge, as a custom rule would, and the API is limited per key. Lab Lesson 25 · An edge you can defend
docker compose run --rm lab get /api/admin/users - API of Rumbo [401]: The origin listens on no public port, a tunnel is its way in, TLS to it is Full (strict), and it validates identity itself. Lab Lesson 25 · An edge you can defend
docker compose run --rm lab panel --direct - Queue [saved once]: A queue for movements: at least once, an idempotent consumer, a dead letter queue. Lab Lesson 25 · An edge you can defend
docker compose run --rm lab webhook c-1 R-1043 delivered - Durable Object [final: 50]: A Durable Object per shipment and per counter: one place, one call at a time. KV for flags, D1 for quotes, R2 for proofs, a Workflow for returns. Lab Lesson 25 · An edge you can defend
docker compose run --rm lab race do - The kit: Every claim backed by a span: the refused request answered by the Worker alone, the webhooks with queue send, the consumers with fetch to the origin and the object, and the race. Lab Lesson 25 · An edge you can defend
docker compose exec edge lab spans 6
End of the journey: Each decision is a header, a rule or a guarantee you can point to, and each claim has a command and a span behind it. All of it fits the free plan for a small load, except what the zone needs; R2 asks for a payment method.
Areas
- Who asks
- Everyone who sends Rumbo a request: a person in a browser tracking a shipment, a shop app with its API key, a carrier posting a webhook per movement, an employee using the internal panel, and someone who was not invited. What it does not do: None of them should reach the origin directly: they talk to the edge. Who each one is is not known until the edge or the origin checks it. Lesson 01 · A request goes through the edge, Lesson 15 · Access: identity before the origin
- Finding the edge
- How a request finds Cloudflare: the zone's authoritative DNS, run by Cloudflare, answers a proxied record with Cloudflare's own addresses, and anycast announces those addresses from every data center, so the request arrives at one of them. What it does not do: A DNS only record skips all of it: it answers with the server's real address, with no cache, WAF or Workers on the way. Anycast does not promise the closest city: routing decides. Lesson 01 · A request goes through the edge, Lesson 02 · DNS with or without the proxy
- The edge: one data center · where the request arrived
- The Cloudflare data center where the request arrived. There TLS ends the visitor's encrypted connection; the WAF, Access and the cache can answer before your code runs; and the Worker rumbo-edge runs in a V8 isolate with its bindings: KV, D1, R2, the Cache API, the rate limit, a Durable Object, a queue, a workflow and Hyperdrive, plus a Cron Trigger. What it does not do: It is one data center among many, not the whole network: what the Cache API stores or deletes stays in this one, and nothing in an isolate is global state you can trust. The second TLS leg, to the origin, is a separate connection. Lesson 01 · A request goes through the edge, Lesson 05 · An isolate, not a container, Lesson 07 · A Worker in front of your API
- Your machine
- Where you work: Wrangler, the command line of Workers, and the kit, which runs wrangler dev in Docker with Rumbo's origin and database, so the Worker runs and is tested locally. What it does not do: Local is not the edge: no anycast, no zone, no Workers Cache, no pool in Hyperdrive. What puts a version on the edge is a deploy from here. Lesson 06 · Wrangler and the configuration, Lesson 08 · Testing a Worker, Lesson 09 · Deploy and observe
- Your infrastructure
- What you run outside Cloudflare: the origin, Rumbo's Spring Boot API with its internal panel; PostgreSQL 18 with the shipments; and cloudflared, which opens outbound connections to Cloudflare so the origin needs no open port. What it does not do: Cloudflare protects only the requests that reach it: a port still open on the origin is a way around the edge. The origin does not trust the edge blindly: it validates tokens itself. Lesson 04 · An origin with no open ports, Lesson 15 · Access: identity before the origin, Lesson 21 · Hyperdrive: your Postgres from the edge
Pieces
- Browser · tracks a shipment
- A person on a web page. What it is for: The public tracking page: the same for everyone. What it does not do: It does not see the origin: only the edge. In the kit: It runs in the kit, with no account. Lesson 10 · What the edge keeps, Lesson 20 · Durable Objects over time
- Shop app · calls the API
- Another system calling the API with its key. What it is for: Orders and tracking from the shop. What it does not do: It does not share the budget of other keys. In the kit: It runs in the kit, with no account. Lesson 07 · A Worker in front of your API, Lesson 14 · Rate limiting
- Carrier · reports every movement
- A carrier that posts a webhook per movement. What it is for: Movements arrive in bursts and sometimes twice. What it does not do: It does not wait for the work: it gets 202. In the kit: It runs in the kit, with no account. Lesson 22 · Queues: at least once
- Employee · uses the internal panel
- A person of Rumbo with a login. What it is for: The internal panel, behind Access. What it does not do: It does not reach the panel without identity. In the kit: It runs in the kit, with no account. Lesson 15 · Access: identity before the origin, Lesson 23 · Workflows: steps that survive
- Someone else · knows the origin address
- Whoever was not invited: a bot, an attack, someone who found the address. What it is for: The reason for every layer. What it does not do: Illustrative: the kit plays it with the lab container. In the kit: It runs in the kit, with no account. Lesson 02 · DNS with or without the proxy, Lesson 04 · An origin with no open ports
- Anycast · everywhere
- The same addresses announced from every data center. What it is for: Answer from nearby and spread load and attacks. What it does not do: It does not promise the closest city: routing decides. Free plan: Included. In the kit: Not in the kit: the lessons show it from Cloudflare. Lesson 01 · A request goes through the edge
- DNS · of Cloudflare: proxied records
- The authoritative DNS of your zone, run by Cloudflare. What it is for: A proxied record answers with anycast addresses, so requests meet the edge first. What it does not do: It hides the origin in DNS only, not everywhere. Free plan: Included. In the kit: Not in the kit: the lessons show it from Cloudflare. Lesson 02 · DNS with or without the proxy
- DNS only · straight to a server
- A record answered with its real address. What it is for: Mail, verification and services that must not go through the edge. What it does not do: No cache, no WAF, no Workers on its way. Free plan: Included. In the kit: Not in the kit: the lessons show it from Cloudflare. Lesson 02 · DNS with or without the proxy
- TLS · leg 1
- The end of the encrypted connection of the visitor, with a certificate for your zone. What it is for: Encrypt leg 1; the encryption mode decides leg 2. What it does not do: The padlock says nothing of leg 2: Flexible sends it in plain HTTP. Free plan: Included. In the kit: Partly: the kit runs a stand-in, and the lessons show the rest. Lesson 03 · TLS in two legs
- WAF · rules
- Rules on each request, in fixed phases: custom, rate limiting, managed. What it is for: Stop what no code should see, before the Worker. What it does not do: It compares text: a rule without lower() misses another case. Free plan: 5 custom rules, 1 rate limiting rule, the Free Managed Ruleset. In the kit: Partly: the kit runs a stand-in, and the lessons show the rest. Lesson 13 · WAF: rules on the request, Lesson 14 · Rate limiting
- Access · identity
- A login in front of an application, with policies. What it is for: Internal tools without a VPN; a signed JWT for the origin. What it does not do: It does not close the origin: the origin validates the JWT. Free plan: Zero Trust: free up to 50 users. In the kit: Partly: the kit runs a stand-in, and the lessons show the rest. Lesson 15 · Access: identity before the origin
- Cache · Workers Cache
- Workers Cache: a cache in front of the Worker, by the Cache-Control of its answers. What it is for: Serve what is the same for everyone without running the Worker. What it does not do: The key has no user: never cache personal answers as public. Free plan: Any plan, no price of its own: each request still counts as a Worker request. In the kit: Not in the kit: the lessons show it from Cloudflare. Lesson 10 · What the edge keeps, Lesson 11 · The cache key and its traps
- Worker · rumbo-edge, in a V8 isolate: fetch, queue and scheduled
- Your code, in a V8 isolate of the data center that got the request. What it is for: Decide, rewrite, answer or forward; reach the bindings. What it does not do: No global state you can trust; no Java. Free plan: 100,000 requests a day, 10 ms of CPU each. In the kit: It runs in the kit, with no account. Lesson 05 · An isolate, not a container, Lesson 07 · A Worker in front of your API, Lesson 08 · Testing a Worker
- KV · FLAGS
- A key-value store, cached near its readers. What it is for: Flags, configuration, allow lists. What it does not do: Not a counter: eventual and without atomic operations. Free plan: 100,000 reads and 1,000 writes a day. In the kit: It runs in the kit, with no account. Lesson 16 · KV: fast reads, eventual writes
- D1 · DB, SQLite
- A managed SQL database with the SQL of SQLite. What it is for: Tables the edge reads and writes: the quotes of Rumbo. What it does not do: Not your big relational database: one primary per database. Free plan: 10 databases, 5 GB, 5 million rows read a day. In the kit: It runs in the kit, with no account. Lesson 17 · D1: SQLite at the edge
- R2 · PROOFS
- Object storage with an S3-compatible API. What it is for: Files read by many: the proofs of delivery. What it does not do: No egress fees, but storage and operations are counted. Free plan: 10 GB-month, 1 million Class A, 10 million Class B a month. In the kit: It runs in the kit, with no account. Lesson 18 · R2: objects without egress fees
- Cache API · caches.default
- The cache of one data center, from your code: caches.default, with match, put and delete. What it is for: Keep what the Worker computed, under a key it chooses: the rates of Rumbo. What it does not do: It does not replicate: delete purges this data center only. Free plan: Any plan. In the kit: It runs in the kit, with no account. Lesson 11 · The cache key and its traps, Lesson 12 · Cache from a Worker
- Rate limit · LIMITER
- A counter per key in a window of 10 or 60 seconds, from the Worker. What it is for: A budget per API key, user or tenant. What it does not do: Not exact: per location and eventually consistent. In the kit: It runs in the kit, with no account. Lesson 14 · Rate limiting
- Cron Trigger · 0 3 * * *, UTC
- A schedule that runs the scheduled handler. What it is for: The daily close of Rumbo at 03:00 UTC. What it does not do: Not in your time zone: in UTC. Changes take up to 15 minutes. Free plan: 5 Cron Triggers per account. In the kit: Partly: the kit runs a stand-in, and the lessons show the rest. Lesson 24 · Cron and platform events
- Durable Object · SHIPMENTS
- An instance of your class, one per id, in one place. What it is for: Counters, live state, coordination: one call at a time. What it does not do: Not one global table: one object queues every caller. Free plan: SQLite backend only; 5 GB in total. In the kit: It runs in the kit, with no account. Lesson 19 · Durable Objects: one place per thing, Lesson 20 · Durable Objects over time
- Queue · MOVES
- Messages from a producer to a consumer, in batches. What it is for: Answer now, work later, absorb bursts. What it does not do: Not exactly once: duplicates are rare but possible. Free plan: 10,000 operations a day, 24 hours of retention. In the kit: It runs in the kit, with no account. Lesson 22 · Queues: at least once
- Workflow · RETURNS
- A process of steps whose results are stored. What it is for: Returns that wait days for a person, with retries per step. What it does not do: Not a place for heavy computation: each step is a Worker invocation. Free plan: 3,000 steps a day. In the kit: It runs in the kit, with no account. Lesson 23 · Workflows: steps that survive
- Hyperdrive · PG, to your Postgres
- A pool and a query cache between Workers and your own database. What it is for: Reach PostgreSQL from many data centers without a connection per request. What it does not do: It does not replicate your data, nor invalidate its cache on writes. Free plan: 100,000 queries a day. In the kit: Partly: the kit runs a stand-in, and the lessons show the rest. Lesson 21 · Hyperdrive: your Postgres from the edge
- Wrangler · 4.162.0
- The command line of Workers. What it is for: dev, deploy, versions, tail, d1, kv, r2. What it does not do: It is moving to cf, in open beta since 28 September 2026. In the kit: It runs in the kit, with no account. Lesson 06 · Wrangler and the configuration, Lesson 09 · Deploy and observe
- The kit · wrangler dev
- wrangler dev in Docker, with the origin and the database of Rumbo. What it is for: Every lesson, with no account. What it does not do: No anycast, no zone, no Workers Cache, no pool in Hyperdrive. Free plan: Free: it runs on your machine. In the kit: It runs in the kit, with no account. Lesson 00 · Before you start, Lesson 08 · Testing a Worker
- cloudflared, Tunnel · outbound connections to Cloudflare
- The program next to your service that opens the tunnel. What it is for: Publish without an inbound port or a public IP. What it does not do: It does not close other ways in. Free plan: All plans. In the kit: Partly: the kit runs a stand-in, and the lessons show the rest. Lesson 04 · An origin with no open ports
- API of Rumbo · Spring Boot 4.1 on Java 25: the origin, and its panel
- The Spring Boot API of Rumbo: the origin. What it is for: The business: shipments, movements, the panel. What it does not do: It does not trust the edge blindly: it validates tokens. In the kit: It runs in the kit, with no account. Lesson 00 · Before you start, Lesson 15 · Access: identity before the origin, Lesson 22 · Queues: at least once
- PostgreSQL 18 · shipments, movements
- The database of the origin. What it is for: The source of truth for shipments. What it does not do: It is not in Cloudflare: Hyperdrive and the origin reach it. In the kit: It runs in the kit, with no account. Lesson 21 · Hyperdrive: your Postgres from the edge
- Open port · illustrative
- A public port the origin still listens on. What it is for: Nothing: it is the risk the tunnel leaves if you forget it. What it does not do: Cloudflare does not protect requests that never reach it. In the kit: It runs in the kit, with no account. Lesson 04 · An origin with no open ports
What travels
- R · Request
- An HTTP request: a method, a path and headers, and sometimes a body. Comes from: A client: a browser, the shop, a carrier, an employee, the lab. Ends up: The edge first; the origin only if the edge sends it on.
- A · Response
- The answer, with the headers each piece added: x-rumbo-via, cf-cache-status, cf-ray. Comes from: The origin, the Worker or the cache. Ends up: The client, back over leg 1.
- C · Stored copy
- A response kept to answer the next request without running the Worker or calling the origin. Comes from: A response whose Cache-Control allows it. Ends up: The cache in front of the Worker, or the Cache API of one data center.
- J · Signed JWT
- Who the person is, signed: iss, aud, email and an expiry, in the Cf-Access-Jwt-Assertion header. Comes from: Access, after a login and a policy; in the kit, the test issuer of the course. Ends up: The origin, which validates it itself.
- M · Movement
- A message: event id, shipment and status, delivered at least once. Comes from: The webhook of a carrier, through the Worker. Ends up: The queue, its consumer, the origin, and the object of the shipment.
- F · Flag
- A value in KV: the maintenance flag, the last request, the daily close. Comes from: Wrangler, the Worker, or its scheduled handler. Ends up: Every data center that reads it, eventually.
- S · Object state
- The state of one Durable Object: a counter, or a shipment with its status and watchers. Comes from: Calls to that object, one at a time. Ends up: The storage of the object, strongly consistent.
- W · Return instance
- One run of the Workflow of returns, with an id and the stored output of each step. Comes from: A request to start a return. Ends up: The Workflow, until every step has finished.
Panorama
Un pedido, del DNS a tu origen, y lo que decide el borde en el camino
Rumbo sigue envíos. Su origen es una API de Spring Boot con PostgreSQL; delante, un Worker en el borde de Cloudflare, con sus bindings. Este dibujo pone en una escena todas las piezas del curso.
Elegí un recorrido: el punto es el pedido o el mensaje, y sus letras son lo que lleva. Cada parada dice qué se decide en esa pieza y qué lección lo profundiza. Hacé clic en cualquier pieza para ver su ficha: qué es, para qué sirve, qué no hace, el plan gratuito y el kit. Las zonas también tienen ficha.
Las etiquetas dicen cómo ver cada parada por tu cuenta: LABORATORIO en el kit, sin cuenta; CUENTA con una cuenta gratuita de Cloudflare, opcional; ZONA con un dominio propio, que las lecciones muestran como caso de estudio; MODELO solo en las lecciones.
A · A través del borde
DNS, anycast, las etapas, el Worker, el origen
- App de la tienda: El lab hace de cliente de la API: GET /api/shipments/R-1042, al borde del kit en 127.0.0.1:18097. Qué lleva el punto: Pedido. Laboratorio Lección 00 · Antes de empezar
docker compose run --rm lab get /api/shipments/R-1042 - DNS [con proxy]: En Cloudflare el nombre es un registro con proxy: el DNS responde con direcciones anycast de Cloudflare, no con la dirección del origen. Qué lleva el punto: Pedido. Laboratorio Lección 02 · DNS con proxy o sin proxy
docker compose run --rm lab dns www.cloudflare.com - Anycast [colo]: Las mismas direcciones se anuncian desde todos los data centers, y el ruteo lleva el pedido a uno, en general cercano. /cdn-cgi/trace lo nombra en colo. Qué lleva el punto: Pedido. Laboratorio Lección 01 · Un pedido pasa por el borde
docker compose run --rm lab trace - TLS: El tramo 1 termina acá, con un certificado que Cloudflare administra para la zona. El modo de cifrado de la zona decide cómo llega el tramo 2 al origen. Qué lleva el punto: Pedido. Zona Lección 03 · TLS en dos tramos
- WAF: Las reglas propias, de rate limiting y administradas corren en fases fijas. Nada coincide, así que el pedido sigue. Qué lleva el punto: Pedido. Zona Lección 13 · WAF: reglas sobre el pedido
- Cache [no-store]: No hay política de Access en este nombre. La API responde no-store, así que ninguna cache en el camino la puede guardar. Qué lleva el punto: Pedido. Laboratorio Lección 10 · Qué guarda el borde
- Worker: El gateway de Rumbo, en un isolate de V8. La API de administración se rechazaría acá; esta ruta sigue. Qué lleva el punto: Pedido. Laboratorio Lección 07 · Un Worker delante de tu API
- Rate limit [dentro del presupuesto]: El presupuesto de la clave: 5 pedidos cada 10 segundos. Sin x-api-key, todos los clientes comparten el anónimo. Laboratorio Lección 14 · Rate limiting
- cloudflared, Tunnel: En producción el pedido llega al origen por conexiones que cloudflared abrió desde adentro. En el kit el Worker llama a origin:8080 en la red de Compose. Qué lleva el punto: Pedido. Zona Lección 04 · Un origen sin puertos abiertos
- API de Rumbo [x-rumbo-edge]: El origen ve x-rumbo-edge y x-rumbo-request-id, que agregó el Worker. Llamado directo, con lab origin /echo, no ve ninguno. Qué lleva el punto: Pedido. Laboratorio Lección 01 · Un pedido pasa por el borde
docker compose run --rm lab get /echo - Worker: A la salida el Worker agrega x-rumbo-via: edge. Después de la respuesta, ctx.waitUntil registra el último pedido en KV sin hacer esperar al cliente. Qué lleva el punto: Respuesta. Laboratorio Lección 07 · Un Worker delante de tu API
docker compose run --rm lab get /lab/last-request - TLS [cf-ray]: De vuelta por el tramo 1. Un sitio detrás de Cloudflare responde con server: cloudflare y un cf-ray, el Ray ID del pedido. Qué lleva el punto: Respuesta. Laboratorio Lección 01 · Un pedido pasa por el borde
docker compose run --rm lab headers
Fin del recorrido: Cada pedido se encuentra primero con el borde, en el data center donde llegó: TLS, las reglas, la cache y el Worker deciden antes de llamar al origen, y cada uno deja algo que se puede leer en un encabezado.
B · Por fuera del borde
un registro solo DNS, un puerto abierto, un túnel
- Alguien más: Alguien a quien nadie invitó: un bot, un ataque, o una persona que encontró la dirección del origen. Qué lleva el punto: Pedido. Modelo Lección 02 · DNS con proxy o sin proxy
- Solo DNS [dirección real]: Un registro viejo solo DNS la filtra: Cloudflare responde con la dirección real, y los pedidos van directo a ese servidor, sin cache, sin WAF y sin Worker en el camino. Qué lleva el punto: Pedido. Laboratorio Lección 02 · DNS con proxy o sin proxy
docker compose run --rm lab dns github.com - Puerto abierto [sin borde]: Si el origen sigue escuchando en un puerto público, este camino nunca pasa por el borde. Un túnel agrega una entrada; no cierra las otras. Qué lleva el punto: Pedido. Modelo Lección 04 · Un origen sin puertos abiertos
- API de Rumbo [401]: El origen igual pide prueba: su panel valida el token por su cuenta, así que saltear el borde no saltea el control. Qué lleva el punto: Pedido. Laboratorio Lección 15 · Access: identidad antes del origen
docker compose run --rm lab panel --direct - API de Rumbo [:0]: En el kit el origen no publica ningún puerto: el 8080 no tiene dirección en tu máquina. Solo el borde la tiene. Laboratorio Lección 04 · Un origen sin puertos abiertos
docker compose port origin 8080 - cloudflared, Tunnel: Una entrada desde adentro: cloudflared, al lado del servicio, abre conexiones salientes hacia Cloudflare, y el borde manda por ellas los pedidos del nombre. Laboratorio Lección 04 · Un origen sin puertos abiertos
docker compose --profile tunnel up -d tunnel - cloudflared, Tunnel [trycloudflare.com]: Un quick tunnel, sin cuenta: un nombre de trycloudflare.com responde con server: cloudflare y el cuerpo de rumbo-origin. En las corridas de validación tardó entre 14 y 41 segundos. Laboratorio Lección 04 · Un origen sin puertos abiertos
docker compose run --rm lab tunnel - cloudflared, Tunnel [saliente]: Registered tunnel connection: una conexión saliente hacia un data center. Un túnel con nombre mantiene cuatro, hacia dos data centers, y sobrevive reinicios. Laboratorio Lección 04 · Un origen sin puertos abiertos
docker compose logs tunnel
Fin del recorrido: El proxy esconde el origen solo en el DNS. Con ningún puerto abierto y un origen que controla quién llama, encontrar su dirección no alcanza.
C · TLS en dos tramos
el candado cubre el tramo 1; el modo decide el tramo 2
- TLS: El tramo 1, del visitante al borde, con un certificado que Cloudflare administra para la zona. El candado no dice nada del tramo 2. Qué lleva el punto: Pedido. Zona Lección 03 · TLS en dos tramos
- TLS: El tramo 2 depende del modo de cifrado de la zona: Off, Flexible, Full, Full (strict) o Strict. lab tls hace de borde en ese tramo; un impostor responde con un certificado autofirmado para el mismo nombre. Laboratorio Lección 03 · TLS en dos tramos
docker compose --profile tls up -d --wait impostor - API de Rumbo [HTTP plano]: Flexible: el tramo 2 en HTTP plano. Quien esté entre el borde y el origen lo puede leer y cambiar. Qué lleva el punto: Pedido. Laboratorio Lección 03 · TLS en dos tramos
docker compose run --rm lab tls flexible - API de Rumbo [impostor aceptado]: Full: HTTPS sin validar el certificado. Uno autofirmado se acepta, y también cualquier servidor que responda con uno: cifrado, hacia el servidor equivocado. Laboratorio Lección 03 · TLS en dos tramos
docker compose run --rm lab tls full impostor - API de Rumbo [aceptado]: Full (strict) valida el certificado del origen, firmado por la CA de prueba del kit, que representa a las autoridades en las que confía. Laboratorio Lección 03 · TLS en dos tramos
docker compose run --rm lab tls strict origin - API de Rumbo [rechazado]: El impostor con strict: rechazado, DEPTH_ZERO_SELF_SIGNED_CERT. El nombre era el correcto; no lo firmó nadie de confianza. Laboratorio Lección 03 · TLS en dos tramos
docker compose run --rm lab tls strict impostor
Fin del recorrido: Cifrado no alcanza: el tramo 2 también tiene que controlar quién responde. Full (strict) valida el certificado del origen; Full acepta cualquiera.
D · Un Worker adelante
configuración, isolates, decisiones antes del origen, pruebas
- Wrangler: wrangler.jsonc nombra el Worker, su punto de entrada, su fecha de compatibilidad y nueve bindings: COUNTERS, DB, FLAGS, LIMITER, MOVES, PG, PROOFS, RETURNS y SHIPMENTS. Laboratorio Lección 06 · Wrangler y la configuración
docker compose run --rm lab config - Worker [definido, 16 caracteres]: Las vars se commitean con el código; los secretos van a la cuenta, y en local a .dev.vars, que se lee cuando arranca wrangler dev. El lab muestra solo el largo. Laboratorio Lección 06 · Wrangler y la configuración
docker compose exec edge sh -c "echo RUMBO_TOKEN=local-only-value > .dev.vars" - Worker [mismo id, hits + 1]: Un isolate de V8 dentro de un runtime que ya corre: una variable de módulo sobrevive a algunos pedidos. Reiniciá el borde y el id cambia: el estado global no es tuyo. Laboratorio Lección 05 · Un isolate, no un contenedor
docker compose run --rm lab isolate - Worker [204, shop.example]: Una preflight de CORS se responde en el borde, solo para la tienda permitida. Laboratorio Lección 07 · Un Worker delante de tu API
docker compose run --rm lab options /api/shipments/R-1042 https://shop.example - Worker [sin allow-origin]: Para otra página no hay access-control-allow-origin: un navegador ahí no deja que su script lea la respuesta. Laboratorio Lección 07 · Un Worker delante de tu API
docker compose run --rm lab options /api/shipments/R-1042 https://other.example - Worker [403]: La API de administración se rechaza en el borde: el origen no recibe su carga y nunca la ve. Laboratorio Lección 07 · Un Worker delante de tu API
docker compose run --rm lab get /api/admin/users - KV: Después de una respuesta, ctx.waitUntil sigue trabajando hasta 30 segundos: el gateway registra el último pedido en KV. Los pedidos rechazados y las preflight nunca llegaron hasta ahí. Qué lleva el punto: Flag. Laboratorio Lección 07 · Un Worker delante de tu API
docker compose run --rm lab get /lab/last-request - El kit [6 pasaron]: Las pruebas corren dentro de workerd con los bindings simulados: health, la API de administración, CORS, mantenimiento, el reenvío al origen y el 502 de un origen caído. Laboratorio Lección 08 · Probar un Worker
docker compose exec edge npx vitest run - El kit: El origen no es parte de la prueba: vi.spyOn reemplaza el fetch global, para responder como lo haría el origen o fallar como uno caído. Laboratorio Lección 08 · Probar un Worker
docker compose exec edge grep -n "spyOn" test/gateway.test.ts
Fin del recorrido: Cada decisión que se toma en el borde es una que el origen no tiene que tomar, y una que no puede tomar mal. El estado global no es tuyo, y las pruebas corren en el mismo runtime.
E · Desplegar y versiones
subir, desplegar, un reparto gradual
- El kit [1,50 KiB]: Un segundo Worker, rumbo-edge-demo, sin bindings para que entre en el plan gratuito: --dry-run lo arma y se detiene. Laboratorio Lección 09 · Desplegar y observar
docker compose exec edge npx wrangler deploy --dry-run --config deploy/wrangler.jsonc - Wrangler [token: active]: Con labs/.env, el id de tu cuenta y un token que puede editar Workers. Opcional, y nunca se imprime. Cuenta Lección 09 · Desplegar y observar
docker compose run --rm lab account - Worker [v1 al 100%]: wrangler deploy sube una versión y la despliega al 100%: el Worker responde en workers.dev, sin una zona propia. Cuenta Lección 09 · Desplegar y observar
docker compose run --rm lab wrangler deploy --tag v1 - Worker [v2 sin desplegar]: versions upload guarda una versión nueva sin atender pedidos con ella. Un despliegue puede usar solo las últimas 100 versiones subidas. Cuenta Lección 09 · Desplegar y observar
docker compose run --rm lab wrangler versions upload --tag v2 --var VERSION:v2 - Worker [90% y 10%]: versions deploy reparte el tráfico por porcentaje. Correrlo de nuevo mueve el reparto, o vuelve atrás. Cuenta Lección 09 · Desplegar y observar
docker compose run --rm lab wrangler versions deploy --version-tag v1@90% --version-tag v2@10% -y - TLS [casi todo v1]: Cada pedido se enruta por su cuenta: la mayoría recibe v1, algunos v2, y una persona puede ver las dos, salvo que la afinidad de versión deje una clave en una. Cuenta Lección 09 · Desplegar y observar
docker compose run --rm lab split /version 40
Fin del recorrido: Una versión es código y configuración, guardados; un despliegue dice qué versiones atienden pedidos y en qué proporción. Mover el reparto es cómo avanzás o volvés atrás.
F · Qué guarda el borde
Cache-Control, un HIT, la trampa de la clave, la Cache API
- Navegador: Una clienta abre la página pública de seguimiento, GET /track/R-1042: la misma página para todos los que siguen ese envío. Qué lleva el punto: Pedido. Laboratorio Lección 10 · Qué guarda el borde
docker compose run --rm lab get /track/R-1042 - Worker [max-age=60, public]: La página responde cache-control: max-age=60, public: igual para todos, segura de compartir por un minuto. Una zona no la guardaría por defecto, porque es HTML; Workers Cache sí. Qué lleva el punto: Respuesta. Laboratorio Lección 10 · Qué guarda el borde
- Cache [MISS, después HIT]: Workers Cache está delante del Worker y sigue el Cache-Control de sus respuestas: MISS, después HIT. Un HIT no corre el Worker, así que no usa CPU, aunque sigue contando como pedido. wrangler dev no lo ejecuta, así que esto necesita una cuenta. Qué lleva el punto: Copia guardada. Cuenta Lección 10 · Qué guarda el borde
docker compose run --rm lab remote /c/public 2 - Cache [sin HIT]: private, no-store o un Set-Cookie: no se guarda nada. Un 200 sin Cache-Control se guarda por heurística, hasta dos horas. Cuenta Lección 10 · Qué guarda el borde
docker compose run --rm lab remote /c/cookie 2 - Worker: Un perfil es personal, pero esta ruta lo marca public, y la clave de la cache es la URL: no incluye al usuario. El perfil de Ana queda guardado. Qué lleva el punto: Respuesta. Laboratorio Lección 11 · La clave de cache y sus trampas
docker compose run --rm lab get /lab/cache/profile -H x-user:ana - Cache API [Beto recibió a Ana]: Beto pide la misma URL y recibe la entrada guardada: el perfil de Ana, con su dirección. El kit muestra la trampa con la Cache API; la cache de una zona cae igual. Qué lleva el punto: Copia guardada. Laboratorio Lección 11 · La clave de cache y sus trampas
docker compose run --rm lab get /lab/cache/profile -H x-user:beto - Cache API [su propia respuesta]: profile-safe responde private, no-store: no se guarda nada, y cada persona recibe su propia respuesta. Laboratorio Lección 11 · La clave de cache y sus trampas
docker compose run --rm lab get /lab/cache/profile-safe -H x-user:beto - Cache API [HIT]: caches.default desde el Worker: match, put y delete, con una clave que elige. La tarifa de una zona se guarda 60 segundos. Qué lleva el punto: Copia guardada. Laboratorio Lección 12 · Cache desde un Worker
docker compose run --rm lab get "/lab/cache/rate?zone=dub" - Cache API [solo este data center]: delete purga solo este data center: la Cache API no se replica. Para llegar a todos, purgá la zona, o Workers Cache por tag. Laboratorio Lección 12 · Cache desde un Worker
docker compose run --rm lab get "/lab/cache/purge?zone=dub"
Fin del recorrido: La respuesta decide qué se guarda: public solo para lo que es igual para todos, private o no-store para cualquier cosa personal. Purgar arregla el pasado; solo un Cache-Control correcto arregla el futuro.
G · Reglas y presupuestos
una regla sobre la ruta, sus mayúsculas, un límite por clave
- App de la tienda: GET /api/admin/users: una ruta a la que ningún cliente debería llegar. Qué lleva el punto: Pedido. Laboratorio Lección 13 · WAF: reglas sobre el pedido
docker compose run --rm lab get /api/admin/users - WAF: En una zona, una regla propia starts_with(http.request.uri.path, "/api/admin") con Block termina el pedido acá: las fases siguientes y el Worker nunca lo ven. Los bloqueos quedan, muestreados, como eventos de seguridad. Qué lleva el punto: Pedido. Zona Lección 13 · WAF: reglas sobre el pedido
- Worker [403]: El kit no tiene zona, así que el gateway hace de regla: 403 antes del origen, respondido solo por el Worker. Laboratorio Lección 13 · WAF: reglas sobre el pedido
- Worker [404 del origen]: /API/admin/users pasa: la regla compara el texto exacto, con mayúsculas, y Spring Boot responde 404. Una expresión del WAF que ignora mayúsculas usa lower(http.request.uri.path). Laboratorio Lección 13 · WAF: reglas sobre el pedido
docker compose run --rm lab get /API/admin/users - Rate limit [200 cinco veces, después 429]: Un presupuesto por x-api-key: 5 pedidos cada 10 segundos. k1 recibe cinco 200, después 429 con retry-after: 10. Laboratorio Lección 14 · Rate limiting
docker compose run --rm lab limit k1 - Rate limit [su propio presupuesto]: k2 tiene su propio presupuesto. Las cuentas son por lugar y eventualmente consistentes: aproximadas, no exactas. Laboratorio Lección 14 · Rate limiting
docker compose run --rm lab limit k2 3 - WAF: Una regla de rate limiting del WAF corre en su propia fase, antes de cualquier Worker; el plan gratuito incluye una. El binding sabe lo que una regla no, como el tenant detrás de una clave. Zona Lección 14 · Rate limiting
Fin del recorrido: Una regla en la zona corre antes de cualquier Worker; una regla en código corre solo donde corre tu Worker, y las dos comparan el texto tal como está escrito. Un presupuesto por clave cuenta lo que una regla de la zona no ve.
H · Identidad antes del origen
Access, un JWT firmado, un origen que lo valida
- Empleada: Ana, de operaciones, abre el panel interno, desde su casa, sin VPN. Qué lleva el punto: Pedido. Zona Lección 15 · Access: identidad antes del origen
- Access [política: permitir]: Cloudflare Access pregunta quién es: entra con el proveedor de identidad, y una política permite a la gente de operaciones. Qué lleva el punto: Pedido. Zona Lección 15 · Access: identidad antes del origen
- Access: El borde agrega un JWT firmado a los pedidos que pasan: el encabezado Cf-Access-Jwt-Assertion y la cookie CF_Authorization. Qué lleva el punto: Pedido, JWT firmado. Zona Lección 15 · Access: identidad antes del origen
- API de Rumbo [401]: El kit no tiene Access. Sin token, el origen pide uno. Laboratorio Lección 15 · Access: identidad antes del origen
docker compose run --rm lab panel - Worker [emisor de prueba]: El borde del kit sirve un emisor de prueba con su propia clave ES256 y los claims de Access: iss, aud rumbo-panel, el email de Ana y un vencimiento cinco minutos después. Qué lleva el punto: JWT firmado. Laboratorio Lección 15 · Access: identidad antes del origen
docker compose run --rm lab token - API de Rumbo [200]: Spring Security, como resource server, valida cuatro cosas: la firma con las claves publicadas, la audiencia, el emisor y el vencimiento. Qué lleva el punto: JWT firmado. Laboratorio Lección 15 · Access: identidad antes del origen
docker compose run --rm lab panel --token - API de Rumbo [401]: Un token de otra aplicación, vencido o cambiado recibe 401, y el motivo: la audiencia, Jwt expired, Invalid signature. Laboratorio Lección 15 · Access: identidad antes del origen
docker compose run --rm lab panel --tampered - API de Rumbo [401]: Llamado directo, salteando el borde, el origen igual pide prueba. Con Access solo cambian tres valores: la URL de las claves, el emisor y la audiencia. Laboratorio Lección 15 · Access: identidad antes del origen
docker compose run --rm lab panel --direct
Fin del recorrido: Access controla quién es la persona en el borde; el origen valida el token firmado por su cuenta. Llegar al origen por otro camino no saltea el control.
I · Una flag y un contador
KV lee rápido; un Durable Object cuenta bien
- KV: Workers KV guarda la flag de mantenimiento de Rumbo: escrita en almacenes centrales, en cache en los data centers que la leen. Qué lleva el punto: Flag. Laboratorio Lección 16 · KV: leer rápido, escribir eventual
docker compose exec edge npx wrangler kv key put maintenance on --binding FLAGS --local - Worker [503]: El gateway lee la flag: on, así que responde 503, mantenimiento, y no llama al origen. Qué lleva el punto: Flag. Laboratorio Lección 16 · KV: leer rápido, escribir eventual
docker compose run --rm lab get /api/shipments/R-1042 - KV [200 otra vez]: Borrala y el pedido siguiente llega al origen. En local el cambio se ve enseguida; en Cloudflare, otros data centers pueden tardar un minuto o más. Laboratorio Lección 16 · KV: leer rápido, escribir eventual
docker compose exec edge npx wrangler kv key delete maintenance --binding FLAGS --local - KV [final: 1 de 50]: No es un contador: 50 pedidos leen el mismo número viejo, le suman uno y lo vuelven a escribir. KV no tiene operaciones atómicas, y la mayoría de los incrementos se pierden. Laboratorio Lección 16 · KV: leer rápido, escribir eventual
docker compose run --rm lab race kv - Durable Object [final: 50]: Un Durable Object por contador, por el binding COUNTERS, vive en un lugar y atiende una llamada por vez: los 50 incrementos llegan uno detrás del otro. Qué lleva el punto: Estado del objeto. Laboratorio Lección 19 · Durable Objects: un lugar por cosa
docker compose run --rm lab race do - Durable Object [200 de 200]: Su almacenamiento es fuertemente consistente. Pero un objeto es un lugar, con un límite blando cerca de 1.000 pedidos por segundo: para más carga, repartí el estado en más objetos. Laboratorio Lección 19 · Durable Objects: un lugar por cosa
docker compose run --rm lab race do 200 - Durable Object [existe al pedirlo]: Un objeto existe porque se lo pidió: el envío R-1043, todavía sin movimientos, nadie mirando. Laboratorio Lección 19 · Durable Objects: un lugar por cosa
docker compose run --rm lab get /shipments/R-1043/state
Fin del recorrido: KV es para datos que se leen mucho más de lo que se escriben, y es eventual. Un contador necesita un lugar que atienda una llamada por vez: un Durable Object.
J · Datos al lado del Worker
D1 para cotizaciones, R2 para comprobantes, Hyperdrive a Postgres
- Worker: El borde calcula una cotización de envío por su cuenta, sin preguntarle al origen. Qué lleva el punto: Pedido. Laboratorio Lección 17 · D1: SQLite en el borde
docker compose run --rm lab quote MAD 2.5 - D1 [16 EUR]: D1 es SQLite en el borde, con sentencias preparadas y bind. Madrid, 2,5 kg: 12,0 + 1,6 x 2,5 = 16, guardada como una cotización nueva. Laboratorio Lección 17 · D1: SQLite en el borde
- D1 [sin migraciones pendientes]: El esquema cambia con migraciones numeradas, registradas en d1_migrations: aplicar dos veces no hace nada. Laboratorio Lección 17 · D1: SQLite en el borde
docker compose exec edge npx wrangler d1 migrations list rumbo-edge --local - R2 [201]: R2 guarda el comprobante de entrega como un objeto, proofs/R-1043.txt, con su etag. Los cuerpos son streams: el Worker los pasa sin cargarlos en memoria. Laboratorio Lección 18 · R2: objetos sin costo de salida
docker compose run --rm lab proof put R-1043 signed by Ana - R2 [mismo etag]: Leerlo no tiene costo de salida; lo que cuenta es el almacenamiento y las operaciones. R-1044 no tiene comprobante: 404. Laboratorio Lección 18 · R2: objetos sin costo de salida
docker compose run --rm lab proof get R-1043 - Hyperdrive: /direct lee el envío de PostgreSQL por Hyperdrive, con un driver común: Spring Boot no interviene. Laboratorio Lección 21 · Hyperdrive: tu Postgres desde el borde
docker compose run --rm lab get /direct/shipments/R-1044 - PostgreSQL 18 [3 filas]: La misma base que usa el origen. En Cloudflare, Hyperdrive mantiene el pool cerca de ella y guarda lecturas sin invalidarlas cuando hay escrituras; en el kit no hay pool ni cache. Laboratorio Lección 21 · Hyperdrive: tu Postgres desde el borde
docker compose exec db psql -U rumbo -d rumbo -c "SELECT id, status FROM shipments ORDER BY id" - API de Rumbo [servedBy rumbo-origin]: El mismo estado por el origen: dos caminos a una base, y el borde elige. Laboratorio Lección 21 · Hyperdrive: tu Postgres desde el borde
docker compose run --rm lab get /api/shipments/R-1044
Fin del recorrido: Cada almacén tiene su garantía: SQL con migraciones en D1, objetos sin costo de salida en R2, y tu propio Postgres por Hyperdrive, sin mover los datos.
K · El webhook de un transportista
202 enseguida, una cola, un consumidor idempotente, una alarma
- Transportista: Un transportista avisa un movimiento: POST /webhooks/movement, evento m-1, R-1042, delivered. Qué lleva el punto: Pedido. Laboratorio Lección 22 · Queues: al menos una vez
docker compose run --rm lab webhook m-1 R-1042 delivered - Worker [202]: El Worker manda el movimiento a la cola y responde 202 enseguida: el transportista no espera el trabajo. Qué lleva el punto: Movimiento. Laboratorio Lección 22 · Queues: al menos una vez
- Queue: Al menos una vez. El kit entrega un lote cada 2 segundos, con max_retries 2 y una cola de mensajes muertos, movements-dead. Qué lleva el punto: Movimiento. Laboratorio Lección 22 · Queues: al menos una vez
- Worker [attempts: 1]: El handler queue del mismo Worker toma el lote y manda cada movimiento al origen. Qué lleva el punto: Movimiento. Laboratorio Lección 22 · Queues: al menos una vez
- API de Rumbo [guardado]: El id del evento es la clave primaria de la tabla de movimientos: guardado una vez. Qué lleva el punto: Movimiento. Laboratorio Lección 22 · Queues: al menos una vez
- Durable Object: El objeto del envío R-1042 toma el estado nuevo y lo manda por su WebSocket a los navegadores que lo miran. Qué lleva el punto: Estado del objeto. Laboratorio Lección 20 · Durable Objects en el tiempo
- API de Rumbo [ya guardado]: El mismo mensaje dos veces: el origen responde already saved, y no cambia nada. El consumidor tiene que ser idempotente. Laboratorio Lección 22 · Queues: al menos una vez
docker compose run --rm lab webhook m-1 R-1042 delivered - Queue [cola de muertos]: Un estado que el origen rechaza con 422: reintentado, tres intentos, y después movements-dead, en unos ocho segundos. Laboratorio Lección 22 · Queues: al menos una vez
docker compose run --rm lab webhook m-2 R-1042 lost in space - Durable Object [delayed: true]: Sin movimientos en 8 segundos: la alarma del objeto marca el envío como demorado y avisa a quienes lo miran. Un estado final, delivered, cancela la alarma. Laboratorio Lección 20 · Durable Objects en el tiempo
docker compose run --rm lab live R-1044
Fin del recorrido: El transportista recibe 202 enseguida y el trabajo pasa después, al menos una vez. El id del evento vuelve inofensiva una repetición, una cola de mensajes muertos guarda lo que falló, y el objeto del envío nota el silencio.
L · Una devolución que espera
pasos que sobreviven, una persona, un reintento
- App de la tienda: Se pide una devolución del envío R-1043: POST /returns/r-1. Qué lleva el punto: Pedido. Laboratorio Lección 23 · Workflows: pasos que sobreviven
docker compose run --rm lab return start r-1 R-1043 - Worker: El Worker crea una instancia del Workflow de devoluciones con el id r-1. Qué lleva el punto: Pedido. Laboratorio Lección 23 · Workflows: pasos que sobreviven
- Workflow [running]: step.do guarda el registro; step.waitForEvent espera approved. Mientras espera, no corre nada y no se pierde nada. Qué lleva el punto: Instancia de devolución. Laboratorio Lección 23 · Workflows: pasos que sobreviven
- Workflow [running, output null]: Estado running, output null: la instancia espera a una persona, días si hace falta. Laboratorio Lección 23 · Workflows: pasos que sobreviven
docker compose run --rm lab return status r-1 - Workflow [reintegro: attempts 2]: Ana aprueba: un evento approved con su nombre. El reintegro falla una vez a propósito, y solo ese paso se reintenta. Laboratorio Lección 23 · Workflows: pasos que sobreviven
docker compose run --rm lab return approve r-1 ana - Workflow [complete]: Registrada, reintegrada, aprobada por ana, avisada: la salida de cada paso queda guardada. Qué lleva el punto: Instancia de devolución. Laboratorio Lección 23 · Workflows: pasos que sobreviven
- Worker [already_exists]: El mismo id otra vez se rechaza: instance.already_exists. Un pedido duplicado es inofensivo. Laboratorio Lección 23 · Workflows: pasos que sobreviven
docker compose run --rm lab return start r-1 R-1043
Fin del recorrido: Cada paso de un Workflow guarda su resultado, así esperar a una persona o reintentar un paso fallido no pierde nada, y el id de una instancia vuelve inofensivo un pedido repetido.
M · El cierre de las 03:00
un Cron Trigger, Hyperdrive, KV
- Cron Trigger: Un Cron Trigger, 0 3 * * *, en UTC: el cierre diario de Rumbo. Después de un cambio, el horario nuevo puede tardar hasta 15 minutos en llegar a la red. Laboratorio Lección 24 · Cron y eventos de la plataforma
docker compose exec edge grep -n "crons" wrangler.jsonc - Worker [scheduled: ok]: wrangler dev no dispara los Cron Triggers solo: lab cron le pide al Local Explorer que corra el handler scheduled. Laboratorio Lección 24 · Cron y eventos de la plataforma
docker compose exec edge lab cron - Hyperdrive: El handler lee los envíos por estado de PostgreSQL, por Hyperdrive. Laboratorio Lección 24 · Cron y eventos de la plataforma
- PostgreSQL 18: Tres envíos, contados por estado. Laboratorio Lección 24 · Cron y eventos de la plataforma
- KV [close:last]: El cierre se guarda en KV, en close:last. Qué lleva el punto: Flag. Laboratorio Lección 24 · Cron y eventos de la plataforma
- Worker [ok]: El otro camino: /cdn-cgi/local/scheduled, con un cron y una hora opcionales. Los dos responden solo en la dirección del propio borde, por eso el lab los corre adentro. Laboratorio Lección 24 · Cron y eventos de la plataforma
docker compose exec edge curl -s "http://127.0.0.1:8787/cdn-cgi/local/scheduled?cron=0+3+*+*+*"
Fin del recorrido: Un Cron Trigger corre el handler scheduled del Worker a una hora en UTC, con los mismos bindings que un pedido. En local lo corrés a mano.
N · Un borde que se puede defender
qué se guarda, qué protege qué, qué garantiza cada almacén
- Cache: Qué se guarda, y por qué: la página pública max-age=60, la API no-store, un perfil private, la tarifa de una zona en la Cache API de cada data center. Laboratorio Lección 25 · Un borde que se puede defender
- Worker [403]: La API de administración se rechaza en el borde, como lo haría una regla propia, y la API se limita por clave. Laboratorio Lección 25 · Un borde que se puede defender
docker compose run --rm lab get /api/admin/users - API de Rumbo [401]: El origen no escucha en ningún puerto público, un túnel es su entrada, el TLS hacia él es Full (strict), y valida la identidad por su cuenta. Laboratorio Lección 25 · Un borde que se puede defender
docker compose run --rm lab panel --direct - Queue [guardado una vez]: Una cola para los movimientos: al menos una vez, un consumidor idempotente, una cola de mensajes muertos. Laboratorio Lección 25 · Un borde que se puede defender
docker compose run --rm lab webhook c-1 R-1043 delivered - Durable Object [final: 50]: Un Durable Object por envío y por contador: un lugar, una llamada por vez. KV para flags, D1 para cotizaciones, R2 para comprobantes, un Workflow para devoluciones. Laboratorio Lección 25 · Un borde que se puede defender
docker compose run --rm lab race do - El kit: Cada afirmación respaldada por un span: el pedido rechazado que respondió solo el Worker, los webhooks con queue send, los consumidores con fetch al origen y el objeto, y la carrera. Laboratorio Lección 25 · Un borde que se puede defender
docker compose exec edge lab spans 6
Fin del recorrido: Cada decisión es un encabezado, una regla o una garantía que se puede señalar, y cada afirmación tiene un comando y un span detrás. Todo entra en el plan gratuito para una carga chica, salvo lo que necesita la zona; R2 pide un medio de pago.
Zonas
- Quien pide
- Todos los que le mandan un pedido a Rumbo: una persona en un navegador que sigue un envío, la app de una tienda con su clave de API, un transportista que manda un webhook por movimiento, una empleada que usa el panel interno, y alguien que no fue invitado. Qué no hace: Ninguno debería llegar directo al origen: hablan con el borde. Quién es cada uno no se sabe hasta que lo verifica el borde o el origen. Lección 01 · Un pedido pasa por el borde, Lección 15 · Access: identidad antes del origen
- Hacia el borde
- Cómo un pedido encuentra Cloudflare: el DNS con autoridad de la zona, operado por Cloudflare, responde un registro con proxy con direcciones propias de Cloudflare, y anycast anuncia esas direcciones desde todos los data centers, así el pedido llega a uno de ellos. Qué no hace: Un registro solo DNS se saltea todo esto: responde con la dirección real del servidor, sin cache, WAF ni Workers en el camino. Anycast no promete la ciudad más cercana: decide el ruteo. Lección 01 · Un pedido pasa por el borde, Lección 02 · DNS con proxy o sin proxy
- El borde: un data center · donde llegó el pedido
- El data center de Cloudflare donde llegó el pedido. Ahí TLS termina la conexión cifrada del visitante; el WAF, Access y la cache pueden responder antes de que corra tu código; y el Worker rumbo-edge corre en un isolate de V8 con sus bindings: KV, D1, R2, la Cache API, el rate limit, un Durable Object, una queue, un workflow y Hyperdrive, más un Cron Trigger. Qué no hace: Es un data center entre muchos, no toda la red: lo que la Cache API guarda o borra queda en este, y nada en un isolate es estado global confiable. El segundo tramo de TLS, hacia el origen, es otra conexión. Lección 01 · Un pedido pasa por el borde, Lección 05 · Un isolate, no un contenedor, Lección 07 · Un Worker delante de tu API
- Tu máquina
- Donde trabajás: Wrangler, la línea de comandos de Workers, y el kit, que corre wrangler dev en Docker con el origen y la base de Rumbo, así el Worker corre y se prueba en local. Qué no hace: Local no es el borde: sin anycast, sin zona, sin Workers Cache, sin pool en Hyperdrive. Lo que pone una versión en el borde es un deploy desde acá. Lección 06 · Wrangler y la configuración, Lección 08 · Probar un Worker, Lección 09 · Desplegar y observar
- Tu infraestructura
- Lo que corrés fuera de Cloudflare: el origen, la API de Spring Boot de Rumbo con su panel interno; PostgreSQL 18 con los envíos; y cloudflared, que abre conexiones salientes hacia Cloudflare para que el origen no necesite un puerto abierto. Qué no hace: Cloudflare protege solo los pedidos que le llegan: un puerto que sigue abierto en el origen es un camino que esquiva el borde. El origen no confía ciegamente en el borde: valida los tokens por su cuenta. Lección 04 · Un origen sin puertos abiertos, Lección 15 · Access: identidad antes del origen, Lección 21 · Hyperdrive: tu Postgres desde el borde
Piezas
- Navegador · sigue un envío
- Una persona en una página web. Para qué sirve: La página pública de seguimiento: igual para todos. Qué no hace: No ve el origen: solo el borde. En el kit: Corre en el kit, sin cuenta. Lección 10 · Qué guarda el borde, Lección 20 · Durable Objects en el tiempo
- App de la tienda · llama a la API
- Otro sistema que llama a la API con su clave. Para qué sirve: Pedidos y seguimiento desde la tienda. Qué no hace: No comparte el presupuesto de otras claves. En el kit: Corre en el kit, sin cuenta. Lección 07 · Un Worker delante de tu API, Lección 14 · Rate limiting
- Transportista · avisa cada movimiento
- Un transportista que manda un webhook por movimiento. Para qué sirve: Los movimientos llegan en ráfagas y a veces dos veces. Qué no hace: No espera el trabajo: recibe 202. En el kit: Corre en el kit, sin cuenta. Lección 22 · Queues: al menos una vez
- Empleada · entra al panel interno
- Una persona de Rumbo con un login. Para qué sirve: El panel interno, detrás de Access. Qué no hace: No llega al panel sin identidad. En el kit: Corre en el kit, sin cuenta. Lección 15 · Access: identidad antes del origen, Lección 23 · Workflows: pasos que sobreviven
- Alguien más · conoce la dirección del origen
- Quien no fue invitado: un bot, un ataque, alguien que encontró la dirección. Para qué sirve: La razón de cada capa. Qué no hace: Ilustrativo: el kit lo representa con el contenedor del lab. En el kit: Corre en el kit, sin cuenta. Lección 02 · DNS con proxy o sin proxy, Lección 04 · Un origen sin puertos abiertos
- Anycast · en todos lados
- Las mismas direcciones anunciadas desde todos los data centers. Para qué sirve: Responder desde cerca y repartir carga y ataques. Qué no hace: No promete la ciudad más cercana: decide el ruteo. Plan gratuito: Incluido. En el kit: No está en el kit: las lecciones lo muestran desde Cloudflare. Lección 01 · Un pedido pasa por el borde
- DNS · de Cloudflare: registros con proxy
- El DNS con autoridad de tu zona, operado por Cloudflare. Para qué sirve: Un registro con proxy responde con direcciones anycast, así los pedidos se encuentran primero con el borde. Qué no hace: Esconde el origen solo en el DNS, no en todos lados. Plan gratuito: Incluido. En el kit: No está en el kit: las lecciones lo muestran desde Cloudflare. Lección 02 · DNS con proxy o sin proxy
- Solo DNS · directo a un servidor
- Un registro que se responde con su dirección real. Para qué sirve: Mail, verificaciones y servicios que no tienen que pasar por el borde. Qué no hace: Sin cache, sin WAF, sin Workers en su camino. Plan gratuito: Incluido. En el kit: No está en el kit: las lecciones lo muestran desde Cloudflare. Lección 02 · DNS con proxy o sin proxy
- TLS · tramo 1
- El final de la conexión cifrada del visitante, con un certificado para tu zona. Para qué sirve: Cifrar el tramo 1; el modo de cifrado decide el tramo 2. Qué no hace: El candado no dice nada del tramo 2: Flexible lo manda en HTTP plano. Plan gratuito: Incluido. En el kit: En parte: el kit corre un reemplazo, y las lecciones muestran el resto. Lección 03 · TLS en dos tramos
- WAF · reglas
- Reglas sobre cada pedido, en fases fijas: propias, rate limiting, administradas. Para qué sirve: Frenar lo que ningún código debería ver, antes del Worker. Qué no hace: Compara texto: una regla sin lower() no ve otras mayúsculas. Plan gratuito: 5 reglas propias, 1 de rate limiting, el Free Managed Ruleset. En el kit: En parte: el kit corre un reemplazo, y las lecciones muestran el resto. Lección 13 · WAF: reglas sobre el pedido, Lección 14 · Rate limiting
- Access · identidad
- Un login delante de una aplicación, con políticas. Para qué sirve: Herramientas internas sin VPN; un JWT firmado para el origen. Qué no hace: No cierra el origen: el origen valida el JWT. Plan gratuito: Zero Trust: gratis hasta 50 usuarios. En el kit: En parte: el kit corre un reemplazo, y las lecciones muestran el resto. Lección 15 · Access: identidad antes del origen
- Cache · Workers Cache
- Workers Cache: una cache delante del Worker, según el Cache-Control de sus respuestas. Para qué sirve: Servir lo que es igual para todos sin correr el Worker. Qué no hace: La clave no tiene usuario: nunca guardes respuestas personales como públicas. Plan gratuito: Cualquier plan, sin precio propio: cada pedido sigue contando como pedido del Worker. En el kit: No está en el kit: las lecciones lo muestran desde Cloudflare. Lección 10 · Qué guarda el borde, Lección 11 · La clave de cache y sus trampas
- Worker · rumbo-edge, en un isolate de V8: fetch, queue y scheduled
- Tu código, en un isolate de V8 del data center que recibió el pedido. Para qué sirve: Decidir, reescribir, responder o reenviar; llegar a los bindings. Qué no hace: Sin estado global confiable; sin Java. Plan gratuito: 100.000 pedidos por día, 10 ms de CPU cada uno. En el kit: Corre en el kit, sin cuenta. Lección 05 · Un isolate, no un contenedor, Lección 07 · Un Worker delante de tu API, Lección 08 · Probar un Worker
- KV · FLAGS
- Un almacén de clave y valor, en cache cerca de sus lectores. Para qué sirve: Flags, configuración, listas de permitidos. Qué no hace: No es un contador: eventual y sin operaciones atómicas. Plan gratuito: 100.000 lecturas y 1.000 escrituras por día. En el kit: Corre en el kit, sin cuenta. Lección 16 · KV: leer rápido, escribir eventual
- D1 · DB, SQLite
- Una base SQL administrada con el SQL de SQLite. Para qué sirve: Tablas que el borde lee y escribe: las cotizaciones de Rumbo. Qué no hace: No es tu base relacional grande: una principal por base. Plan gratuito: 10 bases, 5 GB, 5 millones de filas leídas por día. En el kit: Corre en el kit, sin cuenta. Lección 17 · D1: SQLite en el borde
- R2 · PROOFS
- Almacenamiento de objetos con una API compatible con S3. Para qué sirve: Archivos que leen muchos: los comprobantes de entrega. Qué no hace: Sin costo de salida, pero se cuentan el almacenamiento y las operaciones. Plan gratuito: 10 GB-mes, 1 millón Clase A, 10 millones Clase B por mes. En el kit: Corre en el kit, sin cuenta. Lección 18 · R2: objetos sin costo de salida
- Cache API · caches.default
- La cache de un data center, desde tu código: caches.default, con match, put y delete. Para qué sirve: Guardar lo que calculó el Worker, bajo una clave que elige: las tarifas de Rumbo. Qué no hace: No se replica: delete purga solo este data center. Plan gratuito: Cualquier plan. En el kit: Corre en el kit, sin cuenta. Lección 11 · La clave de cache y sus trampas, Lección 12 · Cache desde un Worker
- Rate limit · LIMITER
- Un contador por clave en una ventana de 10 o 60 segundos, desde el Worker. Para qué sirve: Un presupuesto por API key, usuario o tenant. Qué no hace: No es exacto: por lugar y eventualmente consistente. En el kit: Corre en el kit, sin cuenta. Lección 14 · Rate limiting
- Cron Trigger · 0 3 * * *, UTC
- Un horario que corre el handler scheduled. Para qué sirve: El cierre diario de Rumbo a las 03:00 UTC. Qué no hace: No en tu zona horaria: en UTC. Los cambios tardan hasta 15 minutos. Plan gratuito: 5 Cron Triggers por cuenta. En el kit: En parte: el kit corre un reemplazo, y las lecciones muestran el resto. Lección 24 · Cron y eventos de la plataforma
- Durable Object · SHIPMENTS
- Una instancia de tu clase, una por id, en un lugar. Para qué sirve: Contadores, estado en vivo, coordinación: una llamada por vez. Qué no hace: No es una tabla global: un objeto hace hacer cola a todos. Plan gratuito: Solo backend SQLite; 5 GB en total. En el kit: Corre en el kit, sin cuenta. Lección 19 · Durable Objects: un lugar por cosa, Lección 20 · Durable Objects en el tiempo
- Queue · MOVES
- Mensajes de un productor a un consumidor, en lotes. Para qué sirve: Responder ahora, trabajar después, absorber ráfagas. Qué no hace: No es exactamente una vez: los duplicados son raros pero posibles. Plan gratuito: 10.000 operaciones por día, 24 horas de retención. En el kit: Corre en el kit, sin cuenta. Lección 22 · Queues: al menos una vez
- Workflow · RETURNS
- Un proceso de pasos cuyos resultados se guardan. Para qué sirve: Devoluciones que esperan días a una persona, con reintentos por paso. Qué no hace: No es lugar para cálculo pesado: cada paso es una invocación de Worker. Plan gratuito: 3.000 pasos por día. En el kit: Corre en el kit, sin cuenta. Lección 23 · Workflows: pasos que sobreviven
- Hyperdrive · PG, a tu Postgres
- Un pool y una cache de consultas entre Workers y tu propia base. Para qué sirve: Llegar a PostgreSQL desde muchos data centers sin una conexión por pedido. Qué no hace: No replica tus datos, ni invalida su cache cuando hay escrituras. Plan gratuito: 100.000 consultas por día. En el kit: En parte: el kit corre un reemplazo, y las lecciones muestran el resto. Lección 21 · Hyperdrive: tu Postgres desde el borde
- Wrangler · 4.162.0
- La línea de comandos de Workers. Para qué sirve: dev, deploy, versions, tail, d1, kv, r2. Qué no hace: Se está pasando a cf, en beta abierta desde el 28 de septiembre de 2026. En el kit: Corre en el kit, sin cuenta. Lección 06 · Wrangler y la configuración, Lección 09 · Desplegar y observar
- El kit · wrangler dev
- wrangler dev en Docker, con el origen y la base de Rumbo. Para qué sirve: Cada lección, sin cuenta. Qué no hace: Sin anycast, sin zona, sin Workers Cache, sin pool en Hyperdrive. Plan gratuito: Gratis: corre en tu máquina. En el kit: Corre en el kit, sin cuenta. Lección 00 · Antes de empezar, Lección 08 · Probar un Worker
- cloudflared, Tunnel · conexiones salientes hacia Cloudflare
- El programa al lado de tu servicio que abre el túnel. Para qué sirve: Publicar sin puerto de entrada ni IP pública. Qué no hace: No cierra otras entradas. Plan gratuito: Todos los planes. En el kit: En parte: el kit corre un reemplazo, y las lecciones muestran el resto. Lección 04 · Un origen sin puertos abiertos
- API de Rumbo · Spring Boot 4.1 sobre Java 25: el origen, y su panel
- La API de Spring Boot de Rumbo: el origen. Para qué sirve: El negocio: envíos, movimientos, el panel. Qué no hace: No confía ciegamente en el borde: valida tokens. En el kit: Corre en el kit, sin cuenta. Lección 00 · Antes de empezar, Lección 15 · Access: identidad antes del origen, Lección 22 · Queues: al menos una vez
- PostgreSQL 18 · envíos, movimientos
- La base del origen. Para qué sirve: La fuente de verdad de los envíos. Qué no hace: No está en Cloudflare: llegan Hyperdrive y el origen. En el kit: Corre en el kit, sin cuenta. Lección 21 · Hyperdrive: tu Postgres desde el borde
- Puerto abierto · ilustrativo
- Un puerto público en el que el origen sigue escuchando. Para qué sirve: Nada: es el riesgo que deja el túnel si te olvidás. Qué no hace: Cloudflare no protege pedidos que nunca le llegan. En el kit: Corre en el kit, sin cuenta. Lección 04 · Un origen sin puertos abiertos
Qué viaja
- R · Pedido
- Un pedido HTTP: un método, una ruta y encabezados, y a veces un cuerpo. De dónde viene: Un cliente: un navegador, la tienda, un transportista, una empleada, el lab. Dónde termina: Primero el borde; el origen solo si el borde lo deja seguir.
- A · Respuesta
- La respuesta, con los encabezados que sumó cada pieza: x-rumbo-via, cf-cache-status, cf-ray. De dónde viene: El origen, el Worker o la cache. Dónde termina: El cliente, de vuelta por el tramo 1.
- C · Copia guardada
- Una respuesta guardada para contestar el pedido siguiente sin correr el Worker ni llamar al origen. De dónde viene: Una respuesta cuyo Cache-Control lo permite. Dónde termina: La cache delante del Worker, o la Cache API de un data center.
- J · JWT firmado
- Quién es la persona, firmado: iss, aud, email y un vencimiento, en el encabezado Cf-Access-Jwt-Assertion. De dónde viene: Access, después de un login y una política; en el kit, el emisor de prueba del curso. Dónde termina: El origen, que lo valida por su cuenta.
- M · Movimiento
- Un mensaje: id de evento, envío y estado, entregado al menos una vez. De dónde viene: El webhook de un transportista, a través del Worker. Dónde termina: La cola, su consumidor, el origen y el objeto del envío.
- F · Flag
- Un valor en KV: la flag de mantenimiento, el último pedido, el cierre diario. De dónde viene: Wrangler, el Worker, o su handler scheduled. Dónde termina: Cada data center que la lee, eventualmente.
- S · Estado del objeto
- El estado de un Durable Object: un contador, o un envío con su estado y quienes lo miran. De dónde viene: Llamadas a ese objeto, de a una. Dónde termina: El almacenamiento del objeto, fuertemente consistente.
- W · Instancia de devolución
- Una ejecución del Workflow de devoluciones, con un id y la salida guardada de cada paso. De dónde viene: Un pedido para empezar una devolución. Dónde termina: El Workflow, hasta que termina cada paso.