I'm trying to run iPython Notebook behind an Apache2 proxy and I'm having trouble with WebSockets.
I'd like to have the notebook accessible from <domain>/python/.
Using a few tutorials and the apache wiki, I managed to write this VirtualHosts
file:
# Trying to proxy WS requests
ProxyPass /python/api/kernels ws://127.0.0.1:8888/python/api/kernels
ProxyPassReverse /python/api/kernels ws://127.0.0.1:8888/python/api/kernels
# Proxy HTTP requests
ProxyPass /python http://127.0.0.1:8888/python
ProxyPassReverse /python http://127.0.0.1:8888/python
ProxyRequests On
# Spoof headers only if the URL contains "/python/" (I have other stuff on this VHost)
<If "%{QUERY_STRING} =~ /python/">
Header set Host "http://127.0.0.1:8888/python"
Header set Origin "http://127.0.0.1:8888/python"
RequestHeader set Host "http://127.0.0.1:8888/python"
RequestHeader set Origin "http://127.0.0.1:8888/python"
</If>
Here's my notebook profile config:
c = get_config()
c.NotebookApp.ip = '127.0.0.1'
c.NotebookApp.open_browser = False
c.NotebookApp.port = 8888
c.NotebookApp.base_url = '/python/'
c.NotebookApp.tornado_settings = {'static_url_prefix':'/python/static/'}
c.NotebookApp.allow_origin='http://127.0.0.1:8888/python'
c.NotebookApp.notebook_dir = '/home/franga2000/iPython/'
I'm getting this error in the NB console (also for /stdin
and /iopub
:
WARNING:tornado.access:400 GET /python/api/kernels/f2d21678-4fef-4cb4-996f-dcee954b54ca/shell (127.0.0.1) 0.44ms referer=None
I'm using Apache 2.4.7 on Ubuntu 14.04. Also, the notebook is runing in a virtualenv (doubt its relevant).
Does anyone know a way to do this (without switching to nginx)?