0

I am trying to set up Nginx reverse proxy to a web app being served by Python bokeh server as instructed here:

https://bokeh.pydata.org/en/latest/docs/user_guide/server.html

For testing I am using a simple myapp.py from the same link. I use bokeh serve myapp.py --port 5100 to start the app.

My Nginx server is up and running. I have modified the Nginx setup to allow reverse proxy to port 5100 like so:

server {
listen 80 default_server;
server_name _;

access_log  /tmp/bokeh.access.log;
error_log   /tmp/bokeh.error.log debug;

location / {
    proxy_pass http://127.0.0.1:5100;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_http_version 1.1;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $host:$server_port;
    proxy_buffering off;
}

}

However when I visit http://localhost, I get sent to localhost/myapp and a Page 404 error. The app is still running fine on localhost:5100/myapp.

What am I doing wrong? Any help or suggestion would be greatly appreciated.

0

I was able to set up NGINX to reverse proxy requests to port 5006 by specifying the the --prefix option in the bokeh serve command.

Bokeh serve command example:

bokeh serve myapp.py --port=5006 --prefix=/apps

NGINX configuration:

location /apps {
    proxy_pass http://127.0.0.1:5006;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_http_version 1.1;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $host:$server_port;
    proxy_buffering off;
}

You should be able to access your Bokeh application using the URL: http://localhost/apps/myapp.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.