diff --git a/app/api/proxy/route.ts b/app/api/proxy/route.ts index 0662a6d..30d4417 100644 --- a/app/api/proxy/route.ts +++ b/app/api/proxy/route.ts @@ -1,6 +1,9 @@ import { NextRequest, NextResponse } from 'next/server'; -export const runtime = 'edge'; +export const runtime = 'nodejs'; + +// Disable SSL verification for video sources with invalid certificates +process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'; export async function GET(request: NextRequest) { const url = request.nextUrl.searchParams.get('url'); @@ -100,13 +103,13 @@ export async function GET(request: NextRequest) { // For non-m3u8 content (segments, mp4, etc.), stream directly const headers = new Headers(); - + // Copy headers but exclude problematic ones response.headers.forEach((value, key) => { const lowerKey = key.toLowerCase(); if ( - lowerKey !== 'content-encoding' && - lowerKey !== 'content-length' && + lowerKey !== 'content-encoding' && + lowerKey !== 'content-length' && lowerKey !== 'transfer-encoding' ) { headers.set(key, value); diff --git a/lib/api/http-utils.ts b/lib/api/http-utils.ts index 62ffc42..2f03833 100644 --- a/lib/api/http-utils.ts +++ b/lib/api/http-utils.ts @@ -3,6 +3,9 @@ * Handles timeouts and retries */ +// Disable SSL verification for video sources with invalid certificates +process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'; + const REQUEST_TIMEOUT = 15000; const MAX_RETRIES = 3; const RETRY_DELAY = 200;