From c2c5331861e22a83bcc77da451c57d715313bceb Mon Sep 17 00:00:00 2001 From: WebStreamr <210764791+webstreamr@users.noreply.github.com> Date: Mon, 19 May 2025 08:46:46 +0000 Subject: [PATCH] chore(fetcher): remove proxy headers, add default timeout The proxy headers are not improving anything and only cause issues with another extractor that using IP-locking. --- src/utils/Fetcher.test.ts | 15 +++------------ src/utils/Fetcher.ts | 5 +---- 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/src/utils/Fetcher.test.ts b/src/utils/Fetcher.test.ts index a67c01e..15ca8ba 100644 --- a/src/utils/Fetcher.test.ts +++ b/src/utils/Fetcher.test.ts @@ -26,13 +26,10 @@ describe('fetch', () => { { headers: { 'User-Agent': expect.not.stringMatching(/jest/), - 'Forwarded': 'for=127.0.0.1', 'Referer': 'https://some-url.test', - 'X-Forwarded-For': '127.0.0.1', - 'X-Forwarded-Proto': 'https', - 'X-Real-IP': '127.0.0.1', }, responseType: 'text', + timeout: 10000, }, ); }); @@ -55,13 +52,10 @@ describe('fetch', () => { { headers: { 'User-Agent': expect.not.stringMatching(/jest/), - 'Forwarded': 'for=127.0.0.1', 'Referer': 'https://some-url.test', - 'X-Forwarded-For': '127.0.0.1', - 'X-Forwarded-Proto': 'https', - 'X-Real-IP': '127.0.0.1', }, responseType: 'text', + timeout: 10000, }, ); @@ -73,13 +67,10 @@ describe('fetch', () => { { headers: { 'User-Agent': 'jest', - 'Forwarded': 'for=127.0.0.1', 'Referer': 'https://some-url.test', - 'X-Forwarded-For': '127.0.0.1', - 'X-Forwarded-Proto': 'https', - 'X-Real-IP': '127.0.0.1', }, responseType: 'text', + timeout: 10000, }, ); }); diff --git a/src/utils/Fetcher.ts b/src/utils/Fetcher.ts index 5c3dbb6..e00f3d8 100644 --- a/src/utils/Fetcher.ts +++ b/src/utils/Fetcher.ts @@ -34,14 +34,11 @@ export class Fetcher { private readonly getConfig = (ctx: Context, url: URL, config?: AxiosRequestConfig): AxiosRequestConfig => { return { responseType: 'text', + timeout: 10000, ...config, headers: { 'User-Agent': this.createUserAgentForIp(ctx.ip), - 'Forwarded': `for=${ctx.ip}`, 'Referer': `${url.origin}`, - 'X-Forwarded-For': ctx.ip, - 'X-Forwarded-Proto': url.protocol.slice(0, -1), - 'X-Real-IP': ctx.ip, ...config?.headers, }, };