Skip to content

Commit 2511498

Browse files
sainaenbep
authored andcommitted
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
1 parent 9df3736 commit 2511498

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

‎livereload/livereload.go‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ var upgrader = &websocket.Upgrader{
6262
return false
6363
}
6464

65+
if u.Host == r.Host {
66+
return true
67+
}
68+
6569
h1, _, err := net.SplitHostPort(u.Host)
6670
if err != nil {
6771
return false

0 commit comments

Comments
 (0)