fix: disable SSL verification and update proxy runtime to Node.js.

This commit is contained in:
kuekhaoyang
2025-11-28 21:26:40 +08:00
parent 132b775c4d
commit e0d965ea62
2 changed files with 10 additions and 4 deletions
+7 -4
View File
@@ -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);
+3
View File
@@ -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;