chore(fetcher): set more headers to mimick browser requests

This commit is contained in:
WebStreamr 2025-05-29 17:55:20 +00:00
parent f2a7da21e0
commit 07ddaab7fb
No known key found for this signature in database
2 changed files with 7 additions and 1 deletions

View file

@ -26,10 +26,13 @@ describe('fetch', () => {
'https://some-url.test/',
{
headers: {
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'Accept-Language': 'en',
'Forwarded': 'for=127.0.0.1',
'Origin': 'https://some-url.test',
'User-Agent': expect.not.stringMatching(/jest/),
'Priority': 'u=0',
'Referer': 'https://some-url.test',
'User-Agent': expect.not.stringMatching(/jest/),
'X-Forwarded-For': '127.0.0.1',
'X-Forwarded-Proto': 'https',
'X-Real-IP': '127.0.0.1',

View file

@ -43,8 +43,11 @@ export class Fetcher {
timeout: 15000,
...config,
headers: {
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'Accept-Language': 'en',
'Forwarded': `for=${ctx.ip}`,
'Origin': `${origin}`,
'Priority': 'u=0',
'Referer': `${referer}`,
'User-Agent': this.createUserAgentForIp(ctx.ip),
'X-Forwarded-For': ctx.ip,