From 281cba8da188eaf3136fdaed08fc836ac1dabf15 Mon Sep 17 00:00:00 2001 From: WebStreamr <210764791+webstreamr@users.noreply.github.com> Date: Wed, 14 May 2025 11:51:48 +0000 Subject: [PATCH] chore(fetcher): always set same URL host as referer --- src/utils/Fetcher.test.ts | 2 ++ src/utils/Fetcher.ts | 1 + 2 files changed, 3 insertions(+) diff --git a/src/utils/Fetcher.test.ts b/src/utils/Fetcher.test.ts index b6797a9..4388c4c 100644 --- a/src/utils/Fetcher.test.ts +++ b/src/utils/Fetcher.test.ts @@ -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', diff --git a/src/utils/Fetcher.ts b/src/utils/Fetcher.ts index ca81fb5..9ef1d82 100644 --- a/src/utils/Fetcher.ts +++ b/src/utils/Fetcher.ts @@ -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,