bokeh server with apache reverseproxy forwards wrong websocket endpoint


My setup is as follows:

(bokeh server: localhost:5006) <-----> (apache reverseproxy: *:80) <------> (clients)

The bokeh server serves 2 versions of the same app, one in english and one in german. These apps are called “bevstat_en” and “bevstat_de” .

The reverseproxy should allow clients to request the german app (bevstat_de) simply by requesting “http://servername/bevstat” , whereas the english one would require the explicit call to “http://servername/bevstat_en”.

Apache config as follows (i haven’t configured the english app yet):

<VirtualHost *:80>
ServerName container

CustomLog "/var/log/httpd/access_log" combined
ErrorLog "/var/log/httpd/error_log"

ProxyPreserveHost On

ProxyPass /bevstat/ws/ ws://
ProxyPassReverse /bevstat/ws/ ws://

ProxyPass /bevstat
ProxyPassReverse /bevstat

<Directory />
    Require all granted
    Options -Indexes

Alias /static /usr/lib/python3.4/site-packages/bokeh/server/static

<Directory /usr/lib/python3.4/site-packages/bokeh/server/static>
    Options +Indexes


This works fine for the http requests. The javascript and css gets proper responses (200), whereas the request for the websocket fails with 404.

Heres are the request headers for the websocket request as sent by the client to the proxy:

GET /bevstat_de/ws?bokeh-protocol-version=1.0&bokeh-session-id=msYLoA99owvg88bDLFTDRPpX5BAGnDwc0CoggT1580tb HTTP/1.1

Host: container

User-Agent: Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:51.0) Gecko/20100101 Firefox/51.0

Accept: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8

Accept-Language: en-US,en;q=0.5

Accept-Encoding: gzip, deflate

Sec-WebSocket-Version: 13

origin: http://container

Sec-WebSocket-Extensions: permessage-deflate

Sec-WebSocket-Key: luLbCKrzJgCjjLWaiVSB1w==

Connection: keep-alive, Upgrade

Pragma: no-cache

Cache-Control: no-cache

Upgrade: websocket

For some reason the client requests the “inner” endpoint “/bevstat_de”, and not the outer endpoint “/bevstat” as with previous requests.

The location of the inner endpoint seems to be contained in the very first request:

" Bokeh.embed.embed_items(docs_json, render_items, “ws://container/bevstat_de/ws”);"

When changing the the proxy config so the outer and inner endpoint are equal, the application works.

I suppose i have to change a setting in the bokeh server but i couldn’t find anything helpful.

Best regards