Before a relay could sit in front of a real shop, it had to meet criteria written down in advance. One of them was about speed. It failed on the first measurement by a wide margin, and a result like that could have pushed the project onto a different platform. This is the record of that measurement, and of the six separate things that went wrong on the way to the first working connection.
The criteria
The proof-of-concept design fixed its pass conditions before any code ran against a client. Two of them matter here.
| Criterion | Definition |
|---|---|
| Bypass paths are untouched | For checkout and account paths, the response through the relay is byte-identical to the response from the origin |
| Latency | The 95th-percentile time to first byte through the relay is within 100 ms of the same measurement without it |
Both are checked by one script. It reports the 95th percentile and not the mean. It compares bodies by hash. And before comparing anything it fetches the origin twice, because some pages are not deterministic: a page that embeds a timestamp or a rotating banner differs from itself. Those pages are reported as not comparable, not as failures.
The failure
The first latency run missed the 100 ms criterion by several hundred milliseconds.
A result like that invites large decisions. If a Worker adds most of a second, the candidates are a paid plan with better routing, or abandoning the edge platform for a self-hosted proxy in the client’s region. The postmortem says so directly: had the place of measurement not been doubted, one of those decisions would have been made, and it would have been wrong.
Finding it

Cloudflare exposes a trace endpoint on every zone that reports, among other things, which edge location served the request. One line shows it.
$ curl -s https://<host>/cdn-cgi/trace | grep colo
colo=LAX # from the office connection
colo=ICN # from a cloud host in Seoul
The office’s internet provider was being routed to a location on the west coast of the United States. The origin is in Korea. Every measured request went from Seoul to Los Angeles to reach the Worker, back to Korea to reach the origin, back to Los Angeles with the response, and back to Seoul. The Worker was being timed on two Pacific crossings.
Measured again from a cloud host in Seoul, where requests were served by the Seoul location, the criterion passed.
Nothing in the Worker changed. The fix was to the measurement. The runbook gained a rule: a result from one vantage point is not a conclusion.
What the relay does cost
A later analysis on a second site separated the Worker’s cost from the path’s.
| Component | Finding |
|---|---|
| Worker CPU | One to three milliseconds per request |
| Wall time | Almost all of it is waiting for the origin |
| Counting visits | Suspected and cleared. The counter is written after the response is returned, so it does not delay it |
| The structural cost | One more TLS handshake per request, between the edge and the origin. It is paid on every request and no change to the Worker’s code removes it |
There is a lever on the last row: TLS session resumption on the origin would shorten the repeated handshake. It was deliberately left alone. The setting belongs to a certificate tool’s managed configuration, and changing it trades away some forward secrecy.
Six failures before the first connection
The latency scare was one episode among several. The first attempt to connect a host, the company’s own shop, failed six times and was rolled back. The second attempt, a day later, worked.
| # | What went wrong | Cause | What changed |
|---|---|---|---|
| 1 | The relay would have fetched itself | The origin address in the site config pointed at a name that resolved back to the relay | The origin value was corrected to a name that does not pass through the relay. The loop guard, which answers 502 with a reason header, was already in place |
| 2 | Requests on the custom host returned 522 | The Worker’s route matched only the service’s own hostname, not custom hostnames | The route became a wildcard over every host |
| 3 | A route fixed in the dashboard disappeared, twice | The deploy command overwrites routes from the config file | Routes live in the config file only |
| 4 | The certificate stayed pending | The wildcard route made the Worker intercept the certificate authority’s validation request | /.well-known/ is passed through before any site config is read |
| 5 | DNS validation never matched | The validation record’s value changed each time it was viewed | Validation moved off that method |
| 6 | Delegated validation could not work at all | The domain’s DNS provider answered for the delegation target itself | HTTP validation, which issued the certificate in about a minute |
Three of the six became permanent tests: the validation path always passes, a custom host is recognised by the loop guard, and a config that cannot be read falls back to defaults that keep the loop guard active. The 403 incident described on the edge relay page happened on the same connection and became a fourth.
What changed in the process
- A question added to onboarding: where is your domain’s DNS managed? The answer decides the certificate method before anyone touches a record.
- A checklist per host: the origin name does not pass through the relay, the host is registered with the loop guard, routes are set in the file, the DNS record’s time to live is lowered the day before where the provider allows it, a baseline is measured first, and the connection starts with injection disabled.
- A check that the injection is where readers are. On one site the relay sat on the
wwwhost while the pages’ canonical address was the bare domain. AI crawlers followed the canonical address and never saw the injected content. The runbook now starts by asking which address AI actually reads.
Failure modes
| What happens | What is done |
|---|---|
| A latency number looks alarming | The edge location is checked first, then the measurement is repeated from inside the region |
| A page is not deterministic | It is reported as not comparable and left out of the byte comparison |
| A percentile rests on few samples | It is labelled as such and measured again after a few days |
| A connection goes wrong | The DNS record is restored, and the record’s time to live bounds the outage. One managed DNS fixes that value at 30 minutes |
Limits
- Latency has no automated regression test. It is measured with the probe script before and after a connection, by a person.
- Small samples. A 95th percentile over twenty requests is decided by one slow request.
- The extra handshake remains. It is a property of putting a relay in the path.
- Vantage points are few. Two locations settled this question. Visitors on other networks may be routed elsewhere, and only the edge provider’s own analytics show the full distribution.
