Update config.php

This commit is contained in:
Lizandro Guarnizo
2026-04-19 21:23:45 -05:00
parent 493216caa8
commit 7573d82185
+6 -1
View File
@@ -386,7 +386,12 @@ define('APP_NAME', 'WhatsApp Bot System');
define('APP_VERSION', '2.0.0');
// URL auto-detectada según protocolo y host actuales
if (!defined('APP_URL')) {
$__proto = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http';
// Detectar HTTPS correctamente detrás de proxy reverso (Coolify, nginx, etc.)
$__isHttps = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off')
|| ($_SERVER['HTTP_X_FORWARDED_PROTO'] ?? '') === 'https'
|| ($_SERVER['HTTP_X_FORWARDED_SSL'] ?? '') === 'on'
|| ($_SERVER['HTTP_FRONT_END_HTTPS'] ?? '') === 'on';
$__proto = $__isHttps ? 'https' : 'http';
$__host = $_SERVER['HTTP_HOST'] ?? 'localhost';
define('APP_URL', $__proto . '://' . $__host);
}