diff --git a/IPython/frontend/html/notebook/handlers.py b/IPython/frontend/html/notebook/handlers.py index f0882c0cf..05a06acc4 100644 --- a/IPython/frontend/html/notebook/handlers.py +++ b/IPython/frontend/html/notebook/handlers.py @@ -168,12 +168,15 @@ class AuthenticatedHandler(RequestHandler): @property def ws_url(self): """websocket url matching the current request - + turns http[s]://host[:port] into ws[s]://host[:port] """ proto = self.request.protocol.replace('http', 'ws') - return "%s://%s" % (proto, self.request.host) + host = self.application.ipython_app.websocket_host # default to config value + if host == '': + host = self.request.host # get from request + return "%s://%s" % (proto, host) class AuthenticatedFileHandler(AuthenticatedHandler, web.StaticFileHandler): diff --git a/IPython/frontend/html/notebook/notebookapp.py b/IPython/frontend/html/notebook/notebookapp.py index 4ba5498c6..4adf60eea 100644 --- a/IPython/frontend/html/notebook/notebookapp.py +++ b/IPython/frontend/html/notebook/notebookapp.py @@ -295,11 +295,14 @@ class NotebookApp(BaseIPythonApplication): """set mathjax url to empty if mathjax is disabled""" if not new: self.mathjax_url = u'' - + base_project_url = Unicode('/', config=True, help='''The base URL for the notebook server''') base_kernel_url = Unicode('/', config=True, help='''The base URL for the kernel server''') + websocket_host = Unicode("", config=True, + help="""The hostname for the websocket server.""" + ) mathjax_url = Unicode("", config=True, help="""The url for MathJax.js."""