If a file is served from the browser’s HTTP cache, no network request reaches cy.intercept(), so the intercept cannot fire. Confirm the cache hit in Developer Tools, then choose the fix that matches what your test needs: disable caching for the test environment when you need a fresh request, assert the rendered page when network activity is irrelevant, or use cy.request() to check the server’s cache response.
Why a disk-cached file bypasses cy.intercept()
cy.intercept() observes network traffic. When the browser serves a resource directly from its HTTP cache, it does not make the corresponding network request. There is therefore no request for Cypress to match or intercept. Cypress documents this behavior in its cy.intercept() API reference.
A route matcher cannot fix a request that never reaches the network. First establish whether the browser made a request at all; then decide whether the test needs to observe a request, verify a rendered result, or inspect the server’s caching behavior. Those are different test goals and call for different fixes.
Confirm the browser is serving the file from cache
- Open the browser’s Developer Tools for the Cypress run and inspect the relevant resource in the Network panel.
- Check whether the resource came from cache. If the browser served it from its HTTP cache without a network request, an intercept cannot fire for that delivery.
- Record the test environment: Cypress version and browser. In particular, note whether Cypress 16 is using native network interception with Chrome, Chromium, or Edge; it can affect what Cypress observes. Details are in Cypress’s native network interception guide.
If Developer Tools shows a network request, investigate the route matcher, request URL, and timing instead of treating the issue as a cache hit. If there is no request, use one of the approaches below.
Recommended Free Tools
#1 Best Overall
Choose a fix based on the test’s purpose
| What the test needs to prove | Recommended approach | Scope and trade-off |
|---|---|---|
| That the page made a fresh network request | Disable cache headers in the test environment, or use a narrowly matched middleware intercept to set cache-control: no-store. |
Changes caching for the relevant test traffic. Keep the change out of normal production behavior. |
| That the user sees the expected page or content | Assert on the rendered result rather than requiring an intercepted network event. | Tests the visible outcome without coupling the assertion to whether the browser used its cache. |
| What cache status the server returned | Use cy.request() to inspect the server response. |
Checks the server’s response rather than inferring it from the browser’s cache path. |
| That Chromium can persist HTTPS assets when a development certificate is involved | For the specific certificate-related case, configure trustedCertificates in Cypress 16.1.0 or later. |
Addresses a certificate trust condition that can prevent disk caching; it does not force a request to reach an intercept. |
Make the relevant test responses non-cacheable
Option 1: change cache headers in the test server
If the test must see a network request, the most direct approach is to configure the development server to send non-cacheable responses while running tests. This keeps the behavior tied to the test environment, rather than changing caching for normal users. Apply the change only to the resources the test needs to observe.
Option 2: remove caching in a top-level middleware intercept
Cypress documents using a top-level middleware intercept and a before:response handler to change response headers. Register it before the test actions that could request the resource:
beforeEach(() => {
cy.intercept(
'https://api.example.com/**/*',
{ middleware: true },
(req) => {
req.on('before:response', (res) => {
res.headers['cache-control'] = 'no-store'
})
}
)
})
Replace https://api.example.com/**/* with the actual origin and path under test. A focused matcher avoids changing cache headers for unrelated traffic. This handler can alter a response only when a request reaches the network; it cannot retroactively intercept a file already served from cache without a request.
Rank #2
Option 3: disable browser caching through the Chromium debugging protocol
The Cypress API reference also points to remote:debugger:protocol as a way to disable cache in Chromium-family browsers. The reference directs readers to an issue comment for implementation detail. Check the current Cypress and browser setup requirements before adopting this browser-wide option; it is broader than changing headers for one resource.
Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minutePC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11When to assert on the page instead of the request
If the test’s real purpose is to prove that the user can see the expected content, assert on that content or the relevant rendered state. Requiring a network event in that test adds a condition that may not matter to the user-visible behavior: the browser can correctly render a cached resource without making a new request.
Cypress warns that tests asserting specifically on cache delivery can be affected by Cypress 16’s native network behavior. Decide whether cache delivery is part of the behavior being tested before writing the assertion; do not use an intercept event as a proxy for a rendering result.
When to use cy.request() for server cache behavior
Use cy.request() when the assertion concerns the response the server sends, such as whether the server answers a conditional request with 304 Not Modified. The browser may send a conditional request, receive a 304, merge that response with its cached copy, and present the complete response to Cypress as 200. Cypress recommends cy.request() for checking the server’s cache behavior rather than relying on what the browser-cache path exposes to the test.
This distinction matters in Cypress 16 native interception for Chrome, Chromium, and Edge: Cypress can observe the browser’s native network path, and its view of a revalidated response may not match the status the server returned. See the native interception guide for the version-specific behavior.
Special case: HTTPS disk cache stays empty
There is a separate issue from an intercept missing a request: Chromium may not store HTTPS responses in its disk cache when Cypress has merely ignored a self-signed or private-CA certificate error. If static assets are not persisting across navigations over HTTPS, and the project uses Cypress 16.1.0 or later, Cypress documents the trustedCertificates configuration option.
Rank #4
const { defineConfig } = require('cypress')
module.exports = defineConfig({
trustedCertificates: [{ filePath: 'certs/dev-server.crt' }],
})
Use the certificate file for the certificate actually presented by the test server. Cypress says Chromium matches fingerprints against certificates in the server’s TLS chain: if the server presents an intermediate or CA certificate, declaring that certificate or the leaf works; if it presents only the leaf, declare the leaf. Confirm the server’s certificate before changing the configuration. This option can allow matching HTTPS origins to be trusted so assets are cacheable; it does not disable response caching when your goal is to make a request reach cy.intercept(). The behavior and configuration are described in Cypress’s native network interception guide.
A practical troubleshooting sequence
- Identify the browser and Cypress version. Check whether this is Cypress 16 native interception in Chrome, Chromium, or Edge.
- Inspect the resource in Developer Tools. Determine whether it was delivered from cache or made a network request.
- If a request event is required, make the relevant test-server responses non-cacheable, or register the focused middleware handler before the request.
- If the assertion is about the rendered result, assert on the page rather than requiring a network event.
- If the assertion is about the server’s cache response, use
cy.request()instead of interpreting the browser’s merged response. - If HTTPS assets will not persist in disk cache, and the project uses Cypress 16.1.0 or later, investigate whether an ignored certificate error is involved and configure
trustedCertificatesfor the certificate presented by the server.
Or skip the browser setup
If your goal is simply to capture a website screenshot for a test or workflow, ScreenshotNeo is a website screenshot API and MCP server for developers. A single GET request returns an image or PDF; its clean-shot options handle consent banners, newsletter popups, and chat widgets before capture. Cypress network interception and ScreenshotNeo solve different problems: ScreenshotNeo captures a page, while cy.intercept() observes requests in a Cypress test.
For example, this cURL call saves a WebP screenshot of Stripe; replace the target URL with the page you want to capture:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
See the ScreenshotNeo API documentation for request options. Cookie banners, popups, and chat widgets are removed before the shot; bot checks, blank pages, and failed loads are never billed. An MCP server gives AI agents screenshot tools. The Free plan includes 1,000 shots a month with no card, and paid plans start at $5 for 3,000. Sign up for ScreenshotNeo and get 1,000 free screenshots a month with no card.
Frequently Asked Questions
Does a cached response mean Cypress is broken?
No. A browser cache hit can skip the network layer, leaving no request for an intercept to observe.
Best Value
Can I set cache-control: no-store in an intercept if no request is happening?
No. The response handler runs only after a request reaches the network; a cache hit has no such request.
Does trustedCertificates disable caching?
No. It addresses a specific HTTPS certificate-trust condition that can prevent Chromium from storing assets in its disk cache.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

