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.
This commit is contained in:
WebStreamr 2025-05-19 08:46:46 +00:00
parent 1cc2a182a5
commit c2c5331861
No known key found for this signature in database
2 changed files with 4 additions and 16 deletions

View file

@ -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,
},
);
});

View file

@ -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,
},
};