From afbc16a3ec717275f4f9af134edd9a2542a781c0 Mon Sep 17 00:00:00 2001 From: WebStreamr <210764791+webstreamr@users.noreply.github.com> Date: Sun, 30 Nov 2025 07:24:28 +0000 Subject: [PATCH] revert: "chore: remove proxy headers in requests" This reverts commit 6f6a3ae2fd58548c66822309e8768ae0ef76d9a3. --- src/utils/Fetcher.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/utils/Fetcher.ts b/src/utils/Fetcher.ts index 836833e..f180bd4 100644 --- a/src/utils/Fetcher.ts +++ b/src/utils/Fetcher.ts @@ -146,6 +146,8 @@ export class Fetcher { const cookieString = this.cookieJar.getCookieStringSync(url.href); + const forwardedProto = url.protocol.slice(0, -1); + const hostUserAgent = this.hostUserAgentMap.get(url.host); response = await this.axios.request({ @@ -155,9 +157,16 @@ export class Fetcher { 'Accept-Language': 'en', ...(url.username && { Authorization: 'Basic ' + Buffer.from(`${url.username}:${url.password}`).toString('base64') }), 'Priority': 'u=0', - 'User-Agent': this.hostUserAgentMap.get(url.host) ?? 'Mozilla/5.0', + 'User-Agent': this.hostUserAgentMap.get(url.host) ?? 'Mozilla', ...(hostUserAgent && { 'User-Agent': hostUserAgent }), ...(cookieString && { Cookie: cookieString }), + ...(ctx.ip && { + 'Forwarded': `by=unknown;for=${ctx.ip};host=${url.host};proto=${forwardedProto}`, + 'X-Forwarded-For': ctx.ip, + 'X-Forwarded-Host': url.host, + 'X-Forwarded-Proto': forwardedProto, + 'X-Real-IP': ctx.ip, + }), ...requestConfig?.headers, }, ...(proxyUrl && this.getProxyConfig(proxyUrl)),