From 5e521515d9b90acfc098d54b2d612edfee29113a Mon Sep 17 00:00:00 2001 From: iliajie Date: Sat, 17 Sep 2022 21:46:57 +0300 Subject: [PATCH] Fix to use correct URL name ; consider `musthost` option --- miniserv.pl | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/miniserv.pl b/miniserv.pl index 3f4780130..097e3724e 100755 --- a/miniserv.pl +++ b/miniserv.pl @@ -1399,12 +1399,19 @@ elsif ($reqline !~ /^(\S+)\s+(.*)\s+HTTP\/1\..$/) { } local $url = $wantport == 443 ? "https://$urlhost/" : "https://$urlhost:$wantport/"; + local $jsurl = $config{'musthost'} ? + $url : + "https://'+location.host+'"; + local $jsredir = $config{'musthost'} ? + "location.href='$url'" : + "location.protocol='https:'"; &http_error(200, "Document follows", "This web server is running in SSL mode. ". - "Try the URL $url instead.". + "Trying to redirect to $url instead URL ...". "", 0, 1);