diff --git a/src/utils/Fetcher.ts b/src/utils/Fetcher.ts index 7c3bdc9..0481b59 100644 --- a/src/utils/Fetcher.ts +++ b/src/utils/Fetcher.ts @@ -104,7 +104,7 @@ export class Fetcher { } protected async fetchWithTimeout(ctx: Context, url: URL, requestConfig?: CustomRequestConfig, tryCount = 0): Promise { - const proxyUrl = this.getProxyForUrl(url); + const proxyUrl = this.getProxyForUrl(ctx, url); let message = `Fetch ${requestConfig?.method ?? 'GET'} ${url}`; /* istanbul ignore if */ @@ -319,7 +319,11 @@ export class Fetcher { return new Promise(sleep => setTimeout(sleep, ms)); } - private getProxyForUrl(url: URL): URL | undefined { + private getProxyForUrl(ctx: Context, url: URL): URL | undefined { + if (ctx.config.mediaFlowProxyUrl && url.href.startsWith(ctx.config.mediaFlowProxyUrl)) { + return undefined; + } + const proxyConfig = process.env['PROXY_CONFIG']; if (proxyConfig) {