From b7a8fc4e7602e0e4c100e2837a8328b46e011e0d Mon Sep 17 00:00:00 2001 From: WebStreamr <210764791+webstreamr@users.noreply.github.com> Date: Mon, 12 May 2025 06:49:20 +0000 Subject: [PATCH] feat: send also X-Real-IP next to X-Forwarded-For --- src/utils/Fetcher.test.ts | 8 +++++++- src/utils/Fetcher.ts | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/utils/Fetcher.test.ts b/src/utils/Fetcher.test.ts index a0001a9..f56642c 100644 --- a/src/utils/Fetcher.test.ts +++ b/src/utils/Fetcher.test.ts @@ -35,7 +35,13 @@ describe('fetch', () => { expect(responseText).toBe('some text'); expect(mockedFetch).toHaveBeenCalledWith( 'https://some-url.test', - { headers: { 'User-Agent': expect.not.stringMatching(/jest/), 'X-Forwarded-For': '127.0.0.1' } }, + { + headers: { + 'User-Agent': expect.not.stringMatching(/jest/), + 'X-Forwarded-For': '127.0.0.1', + 'X-Real-IP': '127.0.0.1', + }, + }, ); }); }); diff --git a/src/utils/Fetcher.ts b/src/utils/Fetcher.ts index b95d838..74042f4 100644 --- a/src/utils/Fetcher.ts +++ b/src/utils/Fetcher.ts @@ -25,6 +25,7 @@ export class Fetcher { ...opts?.headers, 'User-Agent': this.createUserAgentForIp(ctx.ip), 'X-Forwarded-For': ctx.ip, + 'X-Real-IP': ctx.ip, }, }, );