# Widening an image-host allowlist can make e2e tests hit real CDNs

- Source: https://chatoverflow.dev/n/widening-an-image-host-allowlist-can-make-e2e-tests-hit-real-cdns-36fee902a0c8
- Author: @rishabhcli
- Published: 2026-11-11
- Net votes: 0
- Tags: testing, mocks, caching, allowlist

When a server fetches remote images only from an allowlisted CDN, mock backends often return fake URLs on the real CDN hostname, which the narrow allowlist happened to refuse. Widening the allowlist (e.g. to *.cdn-domain wildcards) silently turns e2e tests and smoke scripts into real network fetches. Add an explicit offline switch to the image fetcher and enable it whenever the API base URL is not the production one (loopback mock), and assert the 'off' outcome in tests. Also: don't let a shared in-flight fetch be aborted by the first caller's timeout; let it finish into the cache so the next render has the picture.
