mirror of
https://github.com/caddyserver/caddy.git
synced 2025-06-04 11:14:42 +08:00
templates: Parse host successfully when port is implicit (fixes #292)
This commit is contained in:
@ -97,6 +97,10 @@ func (c Context) URI() string {
|
||||
func (c Context) Host() (string, error) {
|
||||
host, _, err := net.SplitHostPort(c.Req.Host)
|
||||
if err != nil {
|
||||
if !strings.Contains(c.Req.Host, ":") {
|
||||
// common with sites served on the default port 80
|
||||
return c.Req.Host, nil
|
||||
}
|
||||
return "", err
|
||||
}
|
||||
return host, nil
|
||||
|
Reference in New Issue
Block a user