Your fetch() Got a 403. Your API Never Saw It.
What your app actually receives when a WAF blocks a real user, and how to tell.

When a WAF or any other layer of the edge blocks a legitimate request, the app usually can’t tell. Across browsers, HTTP clients and error trackers, we found the block arriving disguised as a network failure or as a bug in the app’s own code, with the one ID that explains it thrown away.
This post is a client-side playbook for recognizing those blocks, reporting them, and connecting them back to the edge.
A user writes to support: “The save button doesn’t work.” You open the app and it works. You check the API logs: no errors, no 500s, no request at all. Your error tracker shows a handful of Failed to fetch errors, the same ones it always shows, the ones everyone has learned to ignore. You close the ticket as “could not reproduce.”
Our colleague Yarin Yolles’s series on WAF false positives (see also Part 2 and Part 3) showed why Web Application Firewalls block real users, from the firewall’s side. This post looks at the same blocks from the side of the people who build the app, because that’s where they land, and where they disappear.
In this post, we’ll look at what a WAF block looks like from inside a browser, why most apps can’t tell it apart from a dropped connection, and three things you can add to your app today to make these blocks visible.
The old problem
Client-side error handling was built on a simple assumption: every response comes from your own backend. So the code looks like this, in some form, in almost every app:
const res = await fetch('/api/orders', { method: 'POST', body }); if (!res.ok) throw new Error(`API error ${res.status}`); return res.json();
Anything that doesn’t fit lands in one bucket, “the network,” with a “Something went wrong” toast. That made sense when only the internet stood between the browser and your server: a request that never got an answer meant Wi-Fi, a tunnel, or a server that was down. In every one of those cases, nobody had decided to stop it.
The rest of the stack is built on the same assumption. HTTP clients and data libraries retry “network” failures automatically, error trackers group them as noise, and dashboards treat a small, steady rate of them as normal. All of that is reasonable for a flaky connection. None of it is reasonable for a request someone deliberately stopped.
And that’s what changed. Between your user and your API sit several layers whose job is to stop requests: a CDN with rate limits and bot rules, one or more WAFs, sometimes another WAF on the load balancer. Any of them can answer on your API’s behalf, and none of them answer in your API’s format.
What changed
Three things changed at once, and together they made WAF blocks invisible to the people who build applications.
1. The app became a stream of API calls
A modern single-page app loads one HTML page and then talks to its backend through hundreds of fetch calls. In its 2024 API Security and Management Report, Cloudflare found that API calls made up more than half (57%) of the dynamic, non-cacheable traffic on its network, more than web pages. When a WAF blocked a full page load, the user at least saw a block page. When it blocks a fetch call, that block page is delivered to JavaScript, which tries to parse it as JSON and fails.
2. The API moved to another origin
app.example.com calls api.example.com. That’s a cross-origin request, so the browser only hands the response to your code if it carries the right CORS headers. Your API sends them. The WAF’s block response usually doesn’t. When that happens, the browser hides the response completely and fetch rejects with a generic TypeError, exactly the same error you get when the network is down. Your code literally cannot see the 403.
3. The rules stopped being written by the app team
Most WAFs now run managed rulesets that the vendor updates on its own schedule. The rule blocking your user today may not have existed last week. Nothing changed in your code and nothing failed in your API, so nobody looks in either place.
The result: a request your security stack deliberately stopped looks, from inside the app, like bad Wi-Fi.
The challenge isn’t just detecting that a request failed. It’s understanding which layer of the edge blocked it, which rule triggered the block, and whether the request should have been allowed in the first place.

What we found
What we tested. We kept the firewall fixed and changed everything on the client side. One lab endpoint behind Cloudflare’s Managed Ruleset (the same one Yarin’s series used) answers normal requests and blocks a request for /.env, the file every scanner on the internet probes for, with a 403. Then we called it the way real apps do, varying four things:
- Browser: Chromium 145, Firefox 146 and WebKit 26 (Safari’s engine)
- HTTP client: plain fetch, axios, and TanStack Query (React Query’s engine)
- Error tracker: the Sentry browser SDK with default settings, capturing events locally
- Deployment: page and API on the same origin, and on different origins (app. calling api.), as most production apps are set up
For each combination we recorded what the app’s code received and what the error tracker filed.
Cross-origin: one block, three names
- No status, no body and no headers reached the app’s code.
- Each browser threw a different error, and each is the exact error a dropped connection produces.
- Error trackers group issues by message, so one WAF rule became three small “network” issues. axios reported
Network Erroreverywhere: consistent, but just as empty.
| Browser | Error from fetch | Status seen |
|---|---|---|
| Chromium | TypeError: Failed to fetch | none |
| Firefox | TypeError: NetworkError when attempting to fetch resource. | none |
| WebKit | TypeError: Load failed | none |
Same-origin: the block looks like your own bug
- fetch resolved normally with a 403 and an HTML page, so
res.json()threw aSyntaxError, worded differently in each browser. WebKit’s doesn’t even mention JSON. - Sentry filed it as a
SyntaxError. The 403 only appeared in the breadcrumb trail underneath.
| Browser | Error from res.json() |
|---|---|
| Chromium | SyntaxError: Unexpected token '<', "<!DOCTYPE "... is not valid JSON |
| Firefox | SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data |
| WebKit | SyntaxError: The string did not match the expected pattern. |
Default retries multiply the block
- TanStack Query retried each blocked request 3 times by default, with exponential backoff: the original request plus 3 retries, so 4 blocked requests and 7 seconds of spinner before any error, in every browser.
- To a rate limiter, a frustrated user starts to look like a scanner.
The evidence is thrown away
- Every response carried Cloudflare’s Ray ID, which points to the exact entry in the WAF log.
- Same-origin, JavaScript could read it. Cross-origin, the browser hid it, even on successful requests. Sentry didn’t record it either way.
A WAF block reaches your app disguised as bad Wi-Fi or as a bug in your own code, and the one ID that explains it is thrown away.
Why it matters
This creates a gap that neither team can close alone.
The application team sees errors with no cause. They blame the network, add retries, or spend days hunting a bug that isn’t in their code.
The security team sees blocks in the WAF logs, but a block log can’t say whether it stopped an attacker or a customer. Without a signal from the app, every block looks like a win.
And the business pays for the gap: legitimate users who can’t finish a checkout, a signup or a save, lost conversions and a worse user experience, security decisions made on logs that tell only half the story, and protection switched off to fix problems nobody could diagnose. This isn’t just a debugging problem. It affects revenue and risk at the same time.
And the WAF is only one layer. Between the browser and the API sits the whole edge: a CDN with rate limits and bot rules, one or more WAFs, sometimes another WAF on the load balancer, often from different vendors. Any of them can say no, and without the right response headers their blocks look almost the same in the browser. When someone finally connects the dots, the usual fix is the bluntest one: disable the rule. That trades a visible problem for an invisible hole.
Mini use case: Parcelry, three weeks of “network errors”
Logistics dashboard · fictional company
Parcelry runs a logistics dashboard: app.parcelry.example calling api.parcelry.example through a CDN, a managed WAF ruleset, and a load balancer. After a ruleset update, bulk shipment updates with certain free-text notes start getting blocked. In the browser that’s Failed to fetch, split across three browser-specific “network” issues in the error tracker, all dismissed as noise. The API logs are clean because the requests never arrived. Staff learn to “just retry.”
It takes three weeks and a customer escalation before someone matches support-ticket timestamps against the WAF logs, and even then the team checks the CDN first, because nobody knows which layer said no.
What was missing was two things working together: a signal from the application (“this request was blocked at the edge, here is its reference ID”) and a view of the whole edge that can take that ID and answer which layer, which vendor and which rule blocked it, and whether the client was legitimate. The first part is something every application team can add today. The second is what Huskeys provides: visibility across the network edge, correlating activity across CDNs and WAFs to identify which layer and rule caused a block, understand its impact on legitimate traffic, and help security teams make informed decisions without compromising protection.

What you can do today
1. Teach your fetch layer to recognize the edge
Wrap fetch (or add one interceptor to your HTTP client) so block responses get recognized instead of filed as generic errors:
class EdgeBlockError extends Error { constructor({ status, vendor, reference, url, confidence }) { super(`Request blocked at the edge (${vendor ?? 'unknown vendor'})`); this.name = 'EdgeBlockError'; Object.assign(this, { status, vendor, reference, url, confidence }); } } const BLOCK_STATUSES = new Set([403, 406, 429]); const VENDOR_HEADERS = [ { vendor: 'cloudflare', header: 'cf-ray' }, { vendor: 'azure-front-door', header: 'x-azure-ref' }, { vendor: 'aws-cloudfront', header: 'x-amz-cf-id' }, ]; function identifyEdge(res) { for (const { vendor, header } of VENDOR_HEADERS) { const reference = res.headers.get(header); if (reference) return { vendor, reference }; } return { vendor: null, reference: null }; } export async function edgeAwareFetch(url, init) { let res; try { res = await fetch(url, init); } catch (networkError) { // A CORS-less block and a real outage look identical here. // Ask the same API origin for something harmless to tell them apart. // This is a heuristic: a healthy probe makes an edge block likely, not certain. const apiReachable = await fetch(new URL('/health', new URL(url, location.href))) .then((probe) => probe.ok) .catch(() => false); if (apiReachable) { throw new EdgeBlockError({ url, confidence: 'probable' }); } throw networkError; } const contentType = res.headers.get('content-type') ?? ''; // Status alone isn't proof: your own API can return 403 or 429 too. // An HTML body where you expect JSON is the stronger signal. if (BLOCK_STATUSES.has(res.status) && contentType.includes('text/html')) { throw new EdgeBlockError({ status: res.status, url, confidence: 'likely', ...identifyEdge(res) }); } return res; }
Treat both checks as heuristics, not proof. A 403 can come from your own API’s permission checks, a 429 from your API’s own rate limiter, and a 406 from ordinary content negotiation, and an HTML body is a strong hint rather than a guarantee. That’s why the wrapper looks at the status code together with the content type, attaches the edge’s reference ID when one is present, and labels its verdict with a confidence level instead of a yes or no. The same goes for the health probe: if /health answers, the API is reachable, but the original request could still have failed for another reason, such as a CORS misconfiguration on that one endpoint. Use these labels to group and investigate failures, not to conclude that the WAF was at fault.
Cross-origin, you’ll go further if the block response itself cooperates. AWS WAF lets a Block action return a custom response with its own status code, headers and body (any header name except content-type, within a per-response quota): add Access-Control-Allow-Origin for your app and list the ID header in Access-Control-Expose-Headers, and an invisible block becomes a readable one. Cloudflare’s custom responses, available on custom rules and rate limiting rules, let you set a 4xx status, content type and body, but not response headers. Same-origin, that’s enough to return JSON with a reference your app can show; cross-origin, the browser will still hide the response unless CORS headers reach it. Check what your own WAF, rule type and plan allow.
2. Give blocks their own name in telemetry
Telemetry is the record your app keeps of what happened in the browser: pages opened, buttons clicked, requests that failed, collected by tools like Sentry, PostHog or Amplitude. Report blocks as their own error type, with tags you can filter and alert on:
try { await edgeAwareFetch(url, init); } catch (err) { if (err instanceof EdgeBlockError) { telemetry.captureException(err, { tags: { error_kind: 'edge_block', edge_vendor: err.vendor ?? 'unknown', confidence: err.confidence, endpoint: new URL(err.url).pathname, }, extra: { reference: err.reference }, }); } throw err; }
Now a spike in edge_block errors after a ruleset update is one chart, not three browser-specific issues. Keep user input out of these events; the endpoint and reference ID are enough. And skip automatic retries for these errors (TanStack Query’s retry option accepts a function).
3. Show the user a reference, not a spinner
The user is often the only person who knows a block happened. Give them something to report:
We couldn’t complete this request. If this keeps happening, contact support and mention reference 8c2f1a….
That one reference ID connects a support ticket to the exact request at the edge, which is the step Parcelry was missing for three weeks. Most WAFs already create one; the app just has to keep it:
| Vendor | Reference on a block | Custom block response |
|---|---|---|
| Cloudflare | Ray ID, in the cf-ray header | Status, content type, body |
| Akamai | “Reference #” on the block page | Varies by product |
| F5 Advanced WAF | Support ID on every default block page | Headers and body, with a separate AJAX response |
| AWS WAF | None by default | Status, headers, body |
This matters to the vendors as much as to you. When nobody can explain a block, the WAF gets the blame and the rule gets switched off, which weakens the customer’s protection and the vendor’s value. A block that carries a reference the app can show and report keeps the rule in blocking mode. Customers keep their protection, vendors keep their rules on, and the false positive gets fixed instead of hidden.
Seeing edge blocks from both sides
The edge is doing its job: it stops requests that look dangerous. But when it stops a legitimate one, the app is often the only place that notices, and most apps are built to look away. You can’t fix what you can’t see.
Making blocks visible in the client is the step every application team can take today. Seeing those blocks across every layer and vendor of the edge, understanding why they happened, and acting on them without opening a new hole is what Huskeys is built for.
You shouldn’t have to choose between protecting your application and letting legitimate users through.
Your app’s logs won’t tell you, because blocked requests never reach your backend. Compare your WAF’s block logs with client-side error spikes and support tickets, and tag edge blocks in your telemetry so they stop hiding among network errors.
When the page and API are on different origins, the browser only exposes a response to JavaScript if it includes CORS headers. Most WAF block responses don’t, so the browser hides the response entirely and fetch rejects with a generic TypeError, the same error as a network failure.
In our tests, Sentry filed them as a generic network error (cross-origin) or a JSON parsing error (same-origin), worded differently per browser. Reporting them as a dedicated error type makes them searchable and alertable.
For an ordinary network error, retry with backoff, but cap it. For a request you’ve identified as an edge block, don’t retry automatically: the same rule will most likely block it again, and repeated attempts can trigger rate limits and make legitimate traffic look more like an attack. Show the user a reference instead.
No. A 403 can also come from your own API’s permission checks, and a 429 from your API’s own rate limiter. Look at the status code together with the content type, the response headers and any reference ID from the edge, and treat the result as a likely edge block rather than a certainty.
A Ray ID is the reference Cloudflare attaches to every request, sent in the cf-ray response header. It points to the exact entry in the WAF log, so if your app captures it and shows it to the user, support can find the rule that blocked the request. Cross-origin, the browser hides this header unless the response exposes it via CORS.



