diegosouzapw/OmniRoute · error · Error
Remote media requires HTTPS at every redirect hop
Error message
Remote media requires HTTPS at every redirect hop
What it means
Thrown by requireHttps() in the remote-media fetch pipeline when enforceHttps is enabled and a URL — including any intermediate redirect hop — uses plain http:. The remote media fetcher refuses to follow redirects that downgrade security (GHSA-motivated SSRF/downgrade policy).
Solutions
- Serve the media over HTTPS and fix any redirect chain that downgrades to http:
- If the source is trusted and inherently HTTP-only (e.g. LAN), disable enforceHttps explicitly for that call
- Update the stored media URL to its https: form
- Reject/flag the upstream provider that redirects HTTPS to HTTP
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at src/shared/network/remoteImageFetch.ts:59 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/9fd7faf6b82985f3.
Report an issue: GitHub.
Appendix: source
Thrown at src/shared/network/remoteImageFetch.ts:59
}
export interface RemoteImageFetchResult {
buffer: Buffer<ArrayBuffer>;
contentType: string;
url: string;
}
/** Generic aliases for non-image callers that need the same SSRF/bounds policy. */
export type RemoteMediaFetchOptions = RemoteImageFetchOptions;
export type RemoteMediaFetchResult = RemoteImageFetchResult;
function validateRemoteImageUrl(input: string | URL, guard: OutboundUrlGuardMode) {
return guard === "public-only" ? parseAndValidatePublicUrl(input) : parseOutboundUrl(input);
}
function requireHttps(url: URL, enabled: boolean): URL {
if (enabled && url.protocol !== "https:") {
throw new Error("Remote media requires HTTPS at every redirect hop");
}
return url;
}
const defaultLookup: RemoteImageLookup = (hostname) => dns.promises.lookup(hostname, { all: true });
/** Resolve every answer, reject the host if any answer is private, then return
* the validated addresses so the caller can bind the connection to one of them. */
async function assertHostnameResolvesPublic(
url: URL,
guard: OutboundUrlGuardMode,
lookup: RemoteImageLookup
): Promise<Array<{ address: string; family: number }>> {
if (guard !== "public-only") return [];
const hostname = url.hostname;
const bare =
hostname.startsWith("[") && hostname.endsWith("]") ? hostname.slice(1, -1) : hostname;
if (!bare) return [];View on GitHub (pinned to a179ffed5b)