Fix to prefer SSL_HOST over HTTP_HOST

This commit is contained in:
Ilia Ross
2025-09-24 16:04:19 +03:00
parent 3717dfb505
commit 97678653c6

View File

@@ -13261,10 +13261,12 @@ if (!$def && $gconfig{'webmin_email_url'}) {
# From a config option
$url = $gconfig{'webmin_email_url'};
}
elsif ($ENV{'HTTP_HOST'}) {
elsif ($ENV{'HTTP_HOST'} || $ENV{'SSL_HOST'}) {
# From this HTTP request
my $host = $ENV{'HTTP_HOST'};
my $port = $ENV{'SERVER_PORT'} || 80;
my $host = $ENV{'SSL_HOST'}
? "$ENV{'SSL_HOST'}:$port"
: $ENV{'HTTP_HOST'};
if ($host =~ s/:(\d+)$//) {
$port = $1;
}