Search code examples
javascriptpythonhttpbokeh

Bokeh: change the endpoints for /static


Is there a way to change the endpoint that static JS files get served up from in Bokeh?

  • I have a number of bokeh dashboards that are accessed from behind a load balancer
  • Any request to https://myloadbalancer/{dashboard_name} is sent to the load balancer
  • The loadbalancer then routes the requests to the correct dashboard server based on the value of /{dashboard_name}
  • For any given dashboard, bokeh then attempts to access static javascript via https://myloadbalancer/static
  • For this to work, I need to create a new bokeh server just to serve up static files and then configure the loadbalancer to route requests to https://myloadbalancer/static to the new server
  • This approach is fine, until you start getting different javascript dependencies in the different dashboards
  • Does anyone know of a way to change the /static path of a bokeh dashboard. So that for example it reads static files from https://myloadbalancer/{dashboard_name}/static?

Solution

  • You can run your bokeh serve command with the option --prefix <base_path>. This will put <base_path> behind every resource requested to the Bokeh (Torando) web server, this applies also for /static resources.

    Here you can find the official Bokeh documentation page.

    Kind regards