chore(fetcher): always set same URL host as referer

This commit is contained in:
WebStreamr 2025-05-14 11:51:48 +00:00
parent c5112124f5
commit 281cba8da1
No known key found for this signature in database
2 changed files with 3 additions and 0 deletions

View file

@ -27,6 +27,7 @@ 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',
@ -54,6 +55,7 @@ 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',

View file

@ -40,6 +40,7 @@ export class Fetcher {
...config?.headers,
'User-Agent': this.createUserAgentForIp(ctx.ip),
'Forwarded': `for=${ctx.ip}`,
'Referer': `${url.protocol}//${url.host}`,
'X-Forwarded-For': ctx.ip,
'X-Forwarded-Proto': url.protocol.slice(0, -1),
'X-Real-IP': ctx.ip,