From 91bf8d965f95b708f731fae53dc5421000d3d80b Mon Sep 17 00:00:00 2001 From: Myron Blair Date: Sat, 20 Jun 2026 05:27:30 +0000 Subject: [PATCH] fix: portalUrl stays on proxy host when accessed via reverse proxy on port 443 When HTTP_HOST has no port (NPM on 443), return URL without appending panel port. Direct access (HTTP_HOST includes :8882 etc.) still redirects to correct port. Prevents browser being sent to :8882 directly after login via novacpx.orbishosting.com. Co-Authored-By: Claude Sonnet 4.6 Claude-Session: https://claude.ai/code/session_01LP9Q4kfCAYAjJnsbHBrViZ --- panel/lib/Auth.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/panel/lib/Auth.php b/panel/lib/Auth.php index c4363c2..9230cae 100644 --- a/panel/lib/Auth.php +++ b/panel/lib/Auth.php @@ -151,6 +151,11 @@ class Auth { */ public static function portalUrl(string $role, string $path = '/'): string { $host = $_SERVER['HTTP_HOST'] ?? 'localhost'; + // No port in HTTP_HOST means the request came through a reverse proxy on 443 — stay on same host + if (!preg_match('/:\d+$/', $host)) { + return "https://{$host}{$path}"; + } + // Direct access — redirect to the correct panel port $hostname = preg_replace('/:\d+$/', '', $host); $port = match($role) { 'admin' => PORT_ADMIN,