Running bokeh behind a Nginx with path mapping

Hi all,
I’m trying to run a bokeh (0.12.3) demo app in my docker container with nginx proxy.

The special thing I have, is that Nginx redirects calls from host/pXYZ to localhost:XYZ/

Nginx config

# proxy for general paths

# proxy url: http://reachable-host/p1234/any/resource

# internal url: http://127.0.0.1:1234/any/resource

location ~* /p(?<port>\d+)/((?<path>.*))?$ {

  proxy_pass http://127.0.0.1:$port/$path;

}

``

My docker container serves on 192.168.99.100 and the nginx listens to port :8080

after starting the bokeh app
bokeh serve myapp.py --host 192.168.99.100:8080

``

I’m able to access it using the following URL: http://192.168.99.100:8080/p5006/myapp

but the page is empty and chrome console says: 404 GET http://192.168.99.100:8080/static/css/bokeh.min.css?v=882a547e86d77d573fefc67cb37bb345

Is there a possibility to add a prefix to the rendered resource links?

Forgot to tell that I also added the following entries to the nginx config above:

proxy_set_header Host $host:$server_port;

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

A quick look makes me think that a prefix for the static handler is not configurable. But it might not be to difficult to add support for that, can you make a feature request issue on GitHub and I will schedule it for 0.12.5

In the immediate term I am not sure what the best option is. The Static Handler is set up here:

  https://github.com/bokeh/bokeh/blob/master/bokeh/server/urls.py

If you don't mind patching your bokeh install, you could possibly just update that path there.

Alternatively, you could possibly add a second StaticHandler at a different path, by using the "extra_patterns" argument, but to do that you will need to start the Server programmatically, as shown here:

  https://github.com/bokeh/bokeh/blob/master/examples/howto/server_embed/tornado_embed.py

Thanks,

Bryan

···

On Jan 9, 2017, at 9:20 AM, Dennis Hübner <[email protected]> wrote:

Forgot to tell that I also added the following entries to the nginx config above:

      proxy_set_header Host $host:$server_port;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/4b231bc4-be1d-4bfb-84dc-24c0d679b460%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

Thanks for your answer Bryan.

I will create an enhancement for that in github.

···

Am Dienstag, 10. Januar 2017 00:53:51 UTC+1 schrieb Bryan Van de ven:

A quick look makes me think that a prefix for the static handler is not configurable. But it might not be to difficult to add support for that, can you make a feature request issue on GitHub and I will schedule it for 0.12.5

In the immediate term I am not sure what the best option is. The Static Handler is set up here:

    [https://github.com/bokeh/bokeh/blob/master/bokeh/server/urls.py](https://github.com/bokeh/bokeh/blob/master/bokeh/server/urls.py)

If you don’t mind patching your bokeh install, you could possibly just update that path there.

Alternatively, you could possibly add a second StaticHandler at a different path, by using the “extra_patterns” argument, but to do that you will need to start the Server programmatically, as shown here:

    [https://github.com/bokeh/bokeh/blob/master/examples/howto/server_embed/tornado_embed.py](https://github.com/bokeh/bokeh/blob/master/examples/howto/server_embed/tornado_embed.py)

Thanks,

Bryan

On Jan 9, 2017, at 9:20 AM, Dennis Hübner [email protected] wrote:

Forgot to tell that I also added the following entries to the nginx config above:

  proxy_set_header Host $host:$server_port;
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;


You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/4b231bc4-be1d-4bfb-84dc-24c0d679b460%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.