Skip to content

Commit 580eedf

Browse files
hoatlelepture
authored andcommitted
@ #132 | Script specifies host and port which breaks reverse proxies: fixed (#158)
* @ #132 | Script specifies host and port which breaks reverse proxies: fixed * @ #132 | Script specifies host and port which breaks reverse proxies remove 80, 443 ports from the livereload path
1 parent 77a40ad commit 580eedf

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

livereload/server.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,13 +220,17 @@ def application(self, port, host, liveport=None, debug=None, live_css=True):
220220
# The livereload.js snippet.
221221
# Uses JavaScript to dynamically inject the client's hostname.
222222
# This allows for serving on 0.0.0.0.
223+
live_reload_path = ":{port}/livereload.js?port={port}".format(port=liveport)
224+
if liveport == 80 or liveport == 443:
225+
live_reload_path = "/livereload.js?port={port}".format(port=liveport)
226+
223227
live_script = escape.utf8((
224228
'<script type="text/javascript">'
225229
'document.write("<script src=''//"'
226-
' + window.location.hostname + ":{port}/livereload.js''>'
230+
' + window.location.hostname + "{path}''>'
227231
' </"+"script>");'
228232
'</script>'
229-
).format(port=liveport))
233+
).format(path=live_reload_path))
230234

231235
web_handlers = self.get_web_handlers(live_script)
232236

0 commit comments

Comments
 (0)