mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-07 20:30:36 -05:00
livereload: Fix host comparison when ports aren't present
Compare the original hosts from 'Origin' and 'Host' headers before attempting to do a port-less comparison. This helps in the case when hugo server was started with a '--port=80' so both headers do not contain a port. Fixes #4141
This commit is contained in:
parent
9df3736fec
commit
2511498608
1 changed files with 4 additions and 0 deletions
|
@ -62,6 +62,10 @@ var upgrader = &websocket.Upgrader{
|
|||
return false
|
||||
}
|
||||
|
||||
if u.Host == r.Host {
|
||||
return true
|
||||
}
|
||||
|
||||
h1, _, err := net.SplitHostPort(u.Host)
|
||||
if err != nil {
|
||||
return false
|
||||
|
|
Loading…
Reference in a new issue