chore(fetcher): try to remove the proxy headers (again)

This commit is contained in:
WebStreamr 2025-09-10 11:25:16 +00:00
parent 03b3512380
commit 00bd11495f
No known key found for this signature in database
2 changed files with 2 additions and 14 deletions

View file

@ -31,12 +31,8 @@ describe('fetch', () => {
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'Accept-Language': 'en',
'Authorization': 'Basic dXNlcjpwYXNz',
'Forwarded': 'for=0.0.0.0',
'Priority': 'u=0',
'User-Agent': 'node',
'X-Forwarded-For': '0.0.0.0',
'X-Forwarded-Proto': 'https',
'X-Real-IP': '0.0.0.0',
});
});

View file

@ -46,7 +46,6 @@ export type CustomRequestInit = RequestInit & {
minCacheTtl?: number;
noCache?: boolean;
noFlareSolverr?: boolean;
noProxyHeaders?: boolean;
queueLimit?: number;
queueTimeout?: number;
timeout?: number;
@ -99,9 +98,8 @@ export class Fetcher {
return (await this.cachedFetch(ctx, url, { ...init, method: 'HEAD' })).headers;
};
private getInit(ctx: Context, url: URL, init?: CustomRequestInit): CustomRequestInit {
private getInit(url: URL, init?: CustomRequestInit): CustomRequestInit {
const cookieString = this.cookieJar.getCookieStringSync(url.href);
const noProxyHeaders = init?.noProxyHeaders ?? false;
return {
...init,
@ -112,12 +110,6 @@ export class Fetcher {
'Priority': 'u=0',
'User-Agent': this.hostUserAgentMap.get(url.host) ?? 'node',
...(cookieString && { Cookie: cookieString }),
...(ctx.ip && !noProxyHeaders && {
'Forwarded': `for=${ctx.ip}`,
'X-Forwarded-For': ctx.ip,
'X-Forwarded-Proto': url.protocol.slice(0, -1),
'X-Real-IP': ctx.ip,
}),
...init?.headers,
},
};
@ -234,7 +226,7 @@ export class Fetcher {
};
private async cachedFetch(ctx: Context, url: URL, init?: CustomRequestInit): Promise<HttpCacheItem> {
const newInit = this.getInit(ctx, url, init);
const newInit = this.getInit(url, init);
const request: CachePolicy.Request = { url: url.href, method: newInit.method ?? 'GET', headers: {} };