Ignore trailing . in hostnames.

This means that e.g. `https://site.tld.` will be treated the same as
`https://site.tld`. In DNS, the trailing empty label means "root domain"
and is usually ignored when present. There are some sites with links
that don't work otherwise.
This commit is contained in:
Catherine
2025-11-15 03:12:02 +00:00
parent 3431217a09
commit d604455e1f

View File

@@ -52,6 +52,7 @@ func GetHost(r *http.Request) (string, error) {
return "", AuthError{http.StatusBadRequest,
fmt.Sprintf("host name %q is reserved", host)}
}
host = strings.TrimSuffix(host, ".")
return host, nil
}