mardi 14 juin 2016

Apache reverse proxy of bokeh server not serving interactive content

I have the interactive slider example, sliders.py, running locally on my server with no issues. However, when I try to use Apache 2.4.7 to set up a reverse proxy between bokeh.example.blah and http://127.0.0.1:5006/sliders, the page on a remote computer loads without the interactive element, although HTML elements like the page title do load.

I run sliders.py with this command bokeh serve sliders.py --host bokeh.example.blah A tornado 404 warning pops up when I try to access bokeh.example.blah:

    INFO:bokeh.command.subcommands.serve:Starting Bokeh server on port 5006 with applications at paths ['/sliders']
    DEBUG:bokeh.server.tornado:[pid 7611] 0 clients connected
    DEBUG:bokeh.server.tornado:[pid 7611]   /sliders has 0 sessions with 0 unused
    INFO:tornado.access:200 GET /sliders (127.0.0.1) 43.49ms
    WARNING:tornado.access:404 GET /slidersstatic/css/bokeh.min.css?v=25ce17349a0082e9eeac845e42a822ec (127.0.0.1) 0.84ms
    WARNING:tornado.access:404 GET /slidersstatic/css/bokeh-widgets.min.css?v=3b73ec63df304369ffc9c7e5132463cd (127.0.0.1) 0.78ms
    WARNING:tornado.access:404 GET /slidersstatic/js/bokeh.min.js?v=50ffae624cbe67773b5995270f946406 (127.0.0.1) 0.69ms
    WARNING:tornado.access:404 GET /slidersstatic/js/bokeh-widgets.min.js?v=7cfd458197bc395bb09e9dc3b8ac7975 (127.0.0.1) 0.71ms
    WARNING:tornado.access:404 GET /slidersstatic/js/bokeh-compiler.min.js?v=28af56ac5027aa8d0ab96086ec1da10b (127.0.0.1) 0.74ms

I this is my 000-default.conf

    <VirtualHost *:80>
        ProxyHTMLEnable On

        ProxyPreserveHost On
        ServerName bokeh.example.blah
        ProxyPass / http://127.0.0.1:5006/sliders
        ProxyPassReverse / http://127.0.0.1:5006/sliders

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
    </VirtualHost>

Interestingly, no apache error log is created when this happens.

Googling tells me that serving dynamic content with apache through a reverse proxy is sometimes problematic- this led me to add the 'ProxyHTMLEnable On' to my .conf file. If anyone has seen this sort of issue before and has advice it would be much appreciated!

I also notice that there seem to be a few places that indicate that documnetation about how to deploy bokeh apps is pending. For instance, the empty Deploying for Production section here, or this issue. Does information about this already exist and I'm just looking in the wrong place?

Thanks!

Update:

I now have a different error.

The previous error was due to the fact that I hadn't specified where bokeh keeps its static files. I did so by modifying '000-default.conf' to this:

    <VirtualHost *:80>    
        ServerName bokeh.example.blah                                                                                     

        ProxyPreserveHost On
        ProxyPass /sliders/ws ws://127.0.0.1:5100/sliders/ws
        ProxyPassReverse /sliders/ws ws://127.0.0.1:5100/sliders/ws

        ProxyPass /sliders http://127.0.0.1:5100/sliders/
        ProxyPassReverse /sliders http://127.0.0.1:5100/sliders/

        <Directory />
            Require all granted
            Options -Indexes
        </Directory>

        Alias /static /usr/local/lib/python2.7/dist-packages/bokeh/server/static
        <Directory /usr/local/lib/python2.7/dist-packages/bokeh/server/static>
            # directives to effect the static directory                         
            Options +Indexes
        </Directory>
    </VirtualHost>

As before, I can load only the title of the HTML page, but not the interactive plot. Now, the java console gives me this error:

    WebSocket connection to 'ws://bokeh.example.blah/sliders/ws?bokeh-protocol-version=1.0&bokeh-session-id=pyrxrMepBAnQyAdl4UpACinDdhxcegz0SWtNnonrLngM' failed: Error during WebSocket handshake: Unexpected response code: 500
    bokeh.min.js?v=50ffae6…:62 Bokeh: Failed to connect to Bokeh server Error: Could not open websocket

I would really appreciate advice!

Aucun commentaire:

Enregistrer un commentaire