Reverse-proxying: Flask app with Bokeh server on Nginx

Francis Daly francis at daoine.org
Fri May 12 20:46:30 UTC 2017


On Fri, May 12, 2017 at 04:28:12PM +0200, J K via nginx wrote:

Hi there,

> > location /bokeh/ {
> >     proxy_pass http://127.0.1.1:5006;
> >
> >     # .. with the rest of directives
> > }
> >
> > relaunch the Bokeh app with
> >
> > --prefix=/bokeh/
> >
> > and (if takes part in the url construction rather than application
> > background requests) change the url variable in the Flask app
> >
> > url='http://###.###.###.##:5006'
> > to
> > url='https://yourserver/bokeh/'

> 1. in '/etc/nginx/sites-available/default' I added a new location as follow:
> 
> location /bokeh/ {
> 
>                    proxy_pass http://127.0.0.1:5006;  # you suggested 127.0.
> *1*.1, but I figured that was a typo

The proxy_pass address should be wherever your "bokeh" http server is
actually listening.

Which probably means that whatever you use up there...

> command=/opt/envs/virtual/bin/bokeh serve company_abc.py company_xyz.py
> geomorphix.py --prefix=/bokeh/ --allow-websocket-origin=www.example.com
> --allow-websocket-origin=example.com --host=138.197.132.46:5006
> --use-xheaders

you should also use up there as --host.

I suspect that making them both be 127.0.0.1 will be the easiest
way of reverse-proxying things; but I also suspect that the
"--allow-websocket-origin" part suggests that you may want to configure
nginx to reverse proxy the web socket connection too. Notes are at
http://nginx.org/en/docs/http/websocket.html

It will be helpful to have a very clear picture of what talks to what,
when things are working normally; that should make it easier to be
confident that the same links are in place with nginx in the mix.

Good luck with it,

	f
-- 
Francis Daly        francis at daoine.org


More information about the nginx mailing list