Skip to content

Commit f3b17f1

Browse files
zonrlepture
authored andcommitted
Allow server sitting behind reverse proxy with SSL. (#152)
- Use protocol-relative URL to access livereload.js. - Talk to WebSocket Secure (wss://) when HTTPS is in use.
1 parent a4da58f commit f3b17f1

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

livereload/server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ def application(self, port, host, liveport=None, debug=None, live_css=True):
221221
# This allows for serving on 0.0.0.0.
222222
live_script = escape.utf8((
223223
'<script type="text/javascript">'
224-
'document.write("<script src=''http://"'
224+
'document.write("<script src=''//"'
225225
' + window.location.hostname + ":{port}/livereload.js''>'
226226
' </"+"script>");'
227227
'</script>'

livereload/vendors/livereload.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
this.WebSocket = WebSocket;
1313
this.Timer = Timer;
1414
this.handlers = handlers;
15-
this._uri = "ws://" + this.options.host + ":" + this.options.port + "/livereload";
15+
this._uri = ((window.location.protocol == "https:") ? "wss://" : "ws://") + this.options.host + ":" + this.options.port + "/livereload";
1616
this._nextDelay = this.options.mindelay;
1717
this._connectionDesired = false;
1818
this.protocol = 0;

0 commit comments

Comments
 (0)