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);