diegosouzapw/OmniRoute · error · Error
Remote image redirect missing Location header
Error message
Remote image redirect missing Location header (${response.status}) What it means
Thrown by the manual redirect loop in fetchRemoteImage() when a 3xx response carries no Location header. With `redirect: "manual"`, a redirect without a target cannot be followed, so the fetch fails loudly instead of silently treating the response as content.
Solutions
- Fix the redirecting server to include a Location header on 3xx responses
- Use the final (non-redirecting) URL for the media asset
- If the status is 304, add appropriate cache validators or send the request unconditionally
- Report the misbehaving CDN/host serving broken redirects
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at src/shared/network/remoteImageFetch.ts:219 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of diegosouzapw/OmniRoute@a179ffed5b (2026-08-25).
Data as JSON: /api/errors/49963dac5e6988d5.
Report an issue: GitHub.
Appendix: source
Thrown at src/shared/network/remoteImageFetch.ts:219
for (let redirectCount = 0; redirectCount <= maxRedirects; redirectCount++) {
// DNS-rebinding guard: validate every hop's hostname against its resolved
// IPs before issuing the request (GHSA-cmhj-wh2f-9cgx).
const addresses = await assertHostnameResolvesPublic(currentUrl, guard, lookup);
const fetchImpl =
injectedFetch ??
(pinDns && addresses.length
? createPinnedFetch(addresses[0].address, addresses[0].family)
: fetch);
const response = await fetchImpl(currentUrl.toString(), {
method: "GET",
redirect: "manual",
signal,
});
if (response.status >= 300 && response.status < 400) {
const location = response.headers.get("location");
if (!location) {
throw new Error(`Remote image redirect missing Location header (${response.status})`);
}
if (redirectCount >= maxRedirects) {
throw new Error(`Remote image exceeded ${maxRedirects} redirect limit`);
}
currentUrl = requireHttps(
validateRemoteImageUrl(new URL(location, currentUrl), guard),
options.enforceHttps === true
);
continue;
}
if (!response.ok) {
throw new Error(`Remote image fetch error ${response.status}`);
}
return {
buffer: await readResponseBuffer(response, maxBytes),
contentType: response.headers.get("content-type") || "application/octet-stream",View on GitHub (pinned to a179ffed5b)