feat: send also X-Real-IP next to X-Forwarded-For

This commit is contained in:
WebStreamr 2025-05-12 06:49:20 +00:00
parent 23d123851b
commit b7a8fc4e76
No known key found for this signature in database
2 changed files with 8 additions and 1 deletions

View file

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

View file

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