diff --git a/app/api/proxy/route.ts b/app/api/proxy/route.ts index 591137b..0867e66 100644 --- a/app/api/proxy/route.ts +++ b/app/api/proxy/route.ts @@ -15,9 +15,9 @@ export async function GET(request: NextRequest) { } try { - // Extract headers to forward (Cookies, Accept-Language, Range, etc.) + // Extract headers to forward (only essential ones) const requestHeaders: Record = {}; - const forwardHeaders = ['cookie', 'accept', 'accept-language', 'range']; + const forwardHeaders = ['cookie', 'range']; forwardHeaders.forEach(key => { const value = request.headers.get(key); diff --git a/lib/utils/fetch-with-retry.ts b/lib/utils/fetch-with-retry.ts index 9d60d24..49bb3d0 100644 --- a/lib/utils/fetch-with-retry.ts +++ b/lib/utils/fetch-with-retry.ts @@ -39,11 +39,12 @@ export async function fetchWithRetry({ url, request, headers = {} }: FetchWithRe response = await fetch(url, { headers: { + ...headers, // First: forwarded headers (Cookie, Accept, Range) + // Then override with anti-blocking headers (these take precedence) 'User-Agent': randomUA, 'X-Forwarded-For': forwardedIP, 'Client-IP': forwardedIP, 'Referer': referer, - ...headers, // Merge custom headers (Cookie, Accept, etc.) }, signal: controller.signal, });