From 74bf677f838634844bc67c75907843417430eab8 Mon Sep 17 00:00:00 2001 From: venxm14 Date: Sun, 21 Jun 2026 21:13:45 +0530 Subject: [PATCH] Fixed Proxy URL stripper bug and HTTP protocol bug --- apiServer.js | 1 + proxy/proxyServer.js | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/apiServer.js b/apiServer.js index 61e849d..65013b4 100644 --- a/apiServer.js +++ b/apiServer.js @@ -11,6 +11,7 @@ const { resolveImdbId } = require('./utils/tmdb'); const { applyFilters } = require('./utils/streamFilters'); const app = express(); +app.set('trust proxy', 1); // Conditionally mount proxy routes early so downstream handlers can use them if (config.enableProxy) { diff --git a/proxy/proxyServer.js b/proxy/proxyServer.js index ff56de4..f7e5075 100644 --- a/proxy/proxyServer.js +++ b/proxy/proxyServer.js @@ -95,7 +95,9 @@ function extractOriginalUrl(proxyUrl) { while (decoded.includes('%2F')) { try { decoded = decodeURIComponent(decoded); } catch { break; } } - return decoded; + if (decoded.startsWith('http://') || decoded.startsWith('https://')) return decoded; + // If it's just a path (like Vidlink /proxy/wiwii/...), keep the full original URL + return proxyUrl; } } if (url.searchParams.has('url')) return decodeURIComponent(url.searchParams.get('url'));