mirror of
https://github.com/myronblair/novacpx
synced 2026-06-30 17:50:41 -05:00
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 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LP9Q4kfCAYAjJnsbHBrViZ
This commit is contained in:
@@ -151,6 +151,11 @@ class Auth {
|
|||||||
*/
|
*/
|
||||||
public static function portalUrl(string $role, string $path = '/'): string {
|
public static function portalUrl(string $role, string $path = '/'): string {
|
||||||
$host = $_SERVER['HTTP_HOST'] ?? 'localhost';
|
$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);
|
$hostname = preg_replace('/:\d+$/', '', $host);
|
||||||
$port = match($role) {
|
$port = match($role) {
|
||||||
'admin' => PORT_ADMIN,
|
'admin' => PORT_ADMIN,
|
||||||
|
|||||||
Reference in New Issue
Block a user