having trouble with bokeh server, multiple apps and nginx reverse proxy

First disclosure: I am not very knowledgeable in setting up reverse proxy etc.

I am trying to bokeh serve multiple apps, lets say: appA, appB, appC. I have all my apps in separate folders. I have deployed all the apps by issuing:

bokeh serve appA appB appC --port 5100

When I go to http://localhost:5100, I see all my apps listed. Clicking each of them fire up the app in its own subfolder. For example I can see my appA working in localhost:5100/appA. So far so good.

Now I want to set up nginx as reverse proxy to the bokeh server. I am following the instructions in https://bokeh.pydata.org/en/latest/docs/user_guide/server.html

I have modified the /etc/nginx/sites-enabled/default file (attached) as instructed. After starting the nginx service I can go to http://localhost (port 80) and see all the apps listed there (great!). However when I click on each link for the apps, I get a 404 page error. The apps still function in localhost:5100/app*. I was of the idea that the purpose of the nginx reverse proxy was to allow the apps be reachable directly from port 80.

What could I be doing wrong? I sense its something simple in my setup. Thanks a lot in advance for any suggestion or advice.

default (2.67 KB)

I tried that with a simple single app and the problem persists.
I deployed the myapp.py in https://bokeh.pydata.org/en/latest/docs/user_guide/server.html by running
bokeh serve myapp.py —port 5100
Nginx proxy is set up.
The app runs fine at localhost:5100/myapp but not at localhost/myapp

Have you tried starting bokeh on port 80? (you might need sudo to do that)

Or, what have you done to setup nginx to do the redirect? This isn’t something I know a lot about but I found this stack overflow post.

···

On Thursday, December 27, 2018 at 11:26:31 PM UTC-6, Kaushik Mallick wrote:

First disclosure: I am not very knowledgeable in setting up reverse proxy etc.

I am trying to bokeh serve multiple apps, lets say: appA, appB, appC. I have all my apps in separate folders. I have deployed all the apps by issuing:

bokeh serve appA appB appC --port 5100

When I go to http://localhost:5100, I see all my apps listed. Clicking each of them fire up the app in its own subfolder. For example I can see my appA working in localhost:5100/appA. So far so good.

Now I want to set up nginx as reverse proxy to the bokeh server. I am following the instructions in https://bokeh.pydata.org/en/latest/docs/user_guide/server.html

I have modified the /etc/nginx/sites-enabled/default file (attached) as instructed. After starting the nginx service I can go to http://localhost (port 80) and see all the apps listed there (great!). However when I click on each link for the apps, I get a 404 page error. The apps still function in localhost:5100/app*. I was of the idea that the purpose of the nginx reverse proxy was to allow the apps be reachable directly from port 80.

What could I be doing wrong? I sense its something simple in my setup. Thanks a lot in advance for any suggestion or advice.

I actually just had to deal with this a couple days ago.

I’m not entirely sure my solution works with multiple apps though like you have.

First, modify the nginx config file like they did here: https://bokeh.pydata.org/en/latest/docs/user_guide/server.html just delete the line about listen 80 default server, and change the proxy pass port from 5100 to the port you want to use. I would reboot the server after you do this to make sure your change takes effect.

nginx_config.PNG

Our IT guy also had to add something to the router to tell it to route the name we wanted to call our app to the proper IP address. For example we changed the hostname of our ubuntu server to “theapp”. Now when we type “theapp” into a browser search bar, that request will be redirected to the IP address of the server.

To start the bokeh app I navigate to the folder of the app and type: bokeh serve . --allow-websocket-origin=theapp

I can now type just “theapp” into my browser bar and it will goto the Bokeh app. It automatically appends the name of my bokeh app to the “theapp” so it is going to “theapp/app”. If you have multiple apps perhaps you just have to manually append the name of the particular app you want.

I hope this helps. It was definitely a little bit of a “journey” to get this running, but the nginx config file seemed to be the key.

···

On Tuesday, January 1, 2019 at 8:48:01 AM UTC-7, Sarah Bird wrote:

Have you tried starting bokeh on port 80? (you might need sudo to do that)

Or, what have you done to setup nginx to do the redirect? This isn’t something I know a lot about but I found this stack overflow post.

https://stackoverflow.com/questions/34744713/nginx-redirect-http-to-https-with-custom-port-server

On Thursday, December 27, 2018 at 11:26:31 PM UTC-6, Kaushik Mallick wrote:

First disclosure: I am not very knowledgeable in setting up reverse proxy etc.

I am trying to bokeh serve multiple apps, lets say: appA, appB, appC. I have all my apps in separate folders. I have deployed all the apps by issuing:

bokeh serve appA appB appC --port 5100

When I go to http://localhost:5100, I see all my apps listed. Clicking each of them fire up the app in its own subfolder. For example I can see my appA working in localhost:5100/appA. So far so good.

Now I want to set up nginx as reverse proxy to the bokeh server. I am following the instructions in https://bokeh.pydata.org/en/latest/docs/user_guide/server.html

I have modified the /etc/nginx/sites-enabled/default file (attached) as instructed. After starting the nginx service I can go to http://localhost (port 80) and see all the apps listed there (great!). However when I click on each link for the apps, I get a 404 page error. The apps still function in localhost:5100/app*. I was of the idea that the purpose of the nginx reverse proxy was to allow the apps be reachable directly from port 80.

What could I be doing wrong? I sense its something simple in my setup. Thanks a lot in advance for any suggestion or advice.

Sarah, Thanks for your suggestion.

I tried that but ran into issues starting the bokeh server on port 80 even with sudo.

I might be wrong, but I thought the whole idea of using a proxy server like Nginx is to hide which port the bokeh server is running on when the outside users connect to port 80.

···

On Tuesday, January 1, 2019 at 3:48:01 PM UTC, Sarah Bird wrote:

Have you tried starting bokeh on port 80? (you might need sudo to do that)

Or, what have you done to setup nginx to do the redirect? This isn’t something I know a lot about but I found this stack overflow post.

https://stackoverflow.com/questions/34744713/nginx-redirect-http-to-https-with-custom-port-server

On Thursday, December 27, 2018 at 11:26:31 PM UTC-6, Kaushik Mallick wrote:

First disclosure: I am not very knowledgeable in setting up reverse proxy etc.

I am trying to bokeh serve multiple apps, lets say: appA, appB, appC. I have all my apps in separate folders. I have deployed all the apps by issuing:

bokeh serve appA appB appC --port 5100

When I go to http://localhost:5100, I see all my apps listed. Clicking each of them fire up the app in its own subfolder. For example I can see my appA working in localhost:5100/appA. So far so good.

Now I want to set up nginx as reverse proxy to the bokeh server. I am following the instructions in https://bokeh.pydata.org/en/latest/docs/user_guide/server.html

I have modified the /etc/nginx/sites-enabled/default file (attached) as instructed. After starting the nginx service I can go to http://localhost (port 80) and see all the apps listed there (great!). However when I click on each link for the apps, I get a 404 page error. The apps still function in localhost:5100/app*. I was of the idea that the purpose of the nginx reverse proxy was to allow the apps be reachable directly from port 80.

What could I be doing wrong? I sense its something simple in my setup. Thanks a lot in advance for any suggestion or advice.

Collin, Thank you for your suggestions. I deleted the lines below from my Nginx config file and I get a Page 500 error.

listen 80 default_server;
listen [::]:80 default_server;

``

I followed the instructions verbatim in the link you had provided and continue to struggle with this.

Here is my Nginx config file:

server {
listen 80 default_server;
listen [::]:80 default_server;

    access_log  /home/ubuntu/bokeh/bokeh.access.log;
    error_log   /home/ubuntu/bokeh/bokeh.error.log debug;
root /var/www/html;

# Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html;

server_name _;

location / {

    # First attempt to serve request as file, then
    # as directory, then fall back to displaying a 404.
    try_files $uri $uri/ =404;

    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;
}
    error_page 500 501 502 503 504 401 402 403 /500.html;
    location = /500.html {
    root   /var/www/html;
    }

}

``

I start my bokeh server like so:

bokeh serve myapp --port 5100 --allow-websocket-origin=’*’

``

Then I stop and restart my Nginx server.

I can see my Bokeh app running at http://localhost:5100/myapp, but http://localhost brings me to http://localhost/myapp with a Page 404!

···

On Tuesday, January 1, 2019 at 4:30:46 PM UTC, collin wrote:

I actually just had to deal with this a couple days ago.

I’m not entirely sure my solution works with multiple apps though like you have.

First, modify the nginx config file like they did here: https://bokeh.pydata.org/en/latest/docs/user_guide/server.html just delete the line about listen 80 default server, and change the proxy pass port from 5100 to the port you want to use. I would reboot the server after you do this to make sure your change takes effect.

Our IT guy also had to add something to the router to tell it to route the name we wanted to call our app to the proper IP address. For example we changed the hostname of our ubuntu server to “theapp”. Now when we type “theapp” into a browser search bar, that request will be redirected to the IP address of the server.

To start the bokeh app I navigate to the folder of the app and type: bokeh serve . --allow-websocket-origin=theapp

I can now type just “theapp” into my browser bar and it will goto the Bokeh app. It automatically appends the name of my bokeh app to the “theapp” so it is going to “theapp/app”. If you have multiple apps perhaps you just have to manually append the name of the particular app you want.

I hope this helps. It was definitely a little bit of a “journey” to get this running, but the nginx config file seemed to be the key.

On Tuesday, January 1, 2019 at 8:48:01 AM UTC-7, Sarah Bird wrote:

Have you tried starting bokeh on port 80? (you might need sudo to do that)

Or, what have you done to setup nginx to do the redirect? This isn’t something I know a lot about but I found this stack overflow post.

https://stackoverflow.com/questions/34744713/nginx-redirect-http-to-https-with-custom-port-server

On Thursday, December 27, 2018 at 11:26:31 PM UTC-6, Kaushik Mallick wrote:

First disclosure: I am not very knowledgeable in setting up reverse proxy etc.

I am trying to bokeh serve multiple apps, lets say: appA, appB, appC. I have all my apps in separate folders. I have deployed all the apps by issuing:

bokeh serve appA appB appC --port 5100

When I go to http://localhost:5100, I see all my apps listed. Clicking each of them fire up the app in its own subfolder. For example I can see my appA working in localhost:5100/appA. So far so good.

Now I want to set up nginx as reverse proxy to the bokeh server. I am following the instructions in https://bokeh.pydata.org/en/latest/docs/user_guide/server.html

I have modified the /etc/nginx/sites-enabled/default file (attached) as instructed. After starting the nginx service I can go to http://localhost (port 80) and see all the apps listed there (great!). However when I click on each link for the apps, I get a 404 page error. The apps still function in localhost:5100/app*. I was of the idea that the purpose of the nginx reverse proxy was to allow the apps be reachable directly from port 80.

What could I be doing wrong? I sense its something simple in my setup. Thanks a lot in advance for any suggestion or advice.

Hi,

You have both:

  location / { ... }

and:

  index index.html index.htm index.nginx-debian.html;

I'm not an nginx expert but these options seem incompatible? If the "index" statement takes precedence, and there is no index.html to return, that could explain the 404

Thanks,

Bryan

···

On Jan 3, 2019, at 12:49, [email protected] wrote:

Sarah, Thanks for your suggestion.
I tried that but ran into issues starting the bokeh server on port 80 even with sudo.

I might be wrong, but I thought the whole idea of using a proxy server like Nginx is to hide which port the bokeh server is running on when the outside users connect to port 80.

On Tuesday, January 1, 2019 at 3:48:01 PM UTC, Sarah Bird wrote:
Have you tried starting bokeh on port 80? (you might need sudo to do that)

Or, what have you done to setup nginx to do the redirect? This isn't something I know a lot about but I found this stack overflow post.
https://stackoverflow.com/questions/34744713/nginx-redirect-http-to-https-with-custom-port-server

On Thursday, December 27, 2018 at 11:26:31 PM UTC-6, Kaushik Mallick wrote:
First disclosure: I am not very knowledgeable in setting up reverse proxy etc.

I am trying to bokeh serve multiple apps, lets say: appA, appB, appC. I have all my apps in separate folders. I have deployed all the apps by issuing:

bokeh serve appA appB appC --port 5100

When I go to http://localhost:5100, I see all my apps listed. Clicking each of them fire up the app in its own subfolder. For example I can see my appA working in localhost:5100/appA. So far so good.

Now I want to set up nginx as reverse proxy to the bokeh server. I am following the instructions in https://bokeh.pydata.org/en/latest/docs/user_guide/server.html

I have modified the /etc/nginx/sites-enabled/default file (attached) as instructed. After starting the nginx service I can go to http://localhost (port 80) and see all the apps listed there (great!). However when I click on each link for the apps, I get a 404 page error. The apps still function in localhost:5100/app*. I was of the idea that the purpose of the nginx reverse proxy was to allow the apps be reachable directly from port 80.

What could I be doing wrong? I sense its something simple in my setup. Thanks a lot in advance for any suggestion or advice.

--
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/46b8c0a9-23d3-41ff-b40d-e9ff61c8e32f%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Bryan, there is an index file that Nginx serves up if the Bokeh server is not running.

Once again, I made it work! The culprit seems to be the line:

try_files $uri $uri/ =404;

``

Commenting it out makes the Nginx proxy server work nicely, pointing to the Bokeh server. Meaning I can type in http://localhost and I can see my app running at localhost/myapp.

However there is slight issue with the case of running multiple apps. localhost now brings me to the Bokeh server landing page with the list of apps. How do I tweak the Nginx config file to show the index.html file instead? I am assuming the line I just commented out was meant to do that, going by the comments above it.

···

On Thursday, January 3, 2019 at 9:02:02 PM UTC, Bryan Van de ven wrote:

Hi,

You have both:

    location / { ... }

and:

    index index.html index.htm index.nginx-debian.html;

I’m not an nginx expert but these options seem incompatible? If the “index” statement takes precedence, and there is no index.html to return, that could explain the 404

Thanks,

Bryan

On Jan 3, 2019, at 12:49, [email protected] wrote:

Sarah, Thanks for your suggestion.
I tried that but ran into issues starting the bokeh server on port 80 even with sudo.

I might be wrong, but I thought the whole idea of using a proxy server like Nginx is to hide which port the bokeh server is running on when the outside users connect to port 80.

On Tuesday, January 1, 2019 at 3:48:01 PM UTC, Sarah Bird wrote:

Have you tried starting bokeh on port 80? (you might need sudo to do that)

Or, what have you done to setup nginx to do the redirect? This isn’t something I know a lot about but I found this stack overflow post.

https://stackoverflow.com/questions/34744713/nginx-redirect-http-to-https-with-custom-port-server

On Thursday, December 27, 2018 at 11:26:31 PM UTC-6, Kaushik Mallick wrote:

First disclosure: I am not very knowledgeable in setting up reverse proxy etc.

I am trying to bokeh serve multiple apps, lets say: appA, appB, appC. I have all my apps in separate folders. I have deployed all the apps by issuing:

bokeh serve appA appB appC --port 5100

When I go to http://localhost:5100, I see all my apps listed. Clicking each of them fire up the app in its own subfolder. For example I can see my appA working in localhost:5100/appA. So far so good.

Now I want to set up nginx as reverse proxy to the bokeh server. I am following the instructions in https://bokeh.pydata.org/en/latest/docs/user_guide/server.html

I have modified the /etc/nginx/sites-enabled/default file (attached) as instructed. After starting the nginx service I can go to http://localhost (port 80) and see all the apps listed there (great!). However when I click on each link for the apps, I get a 404 page error. The apps still function in localhost:5100/app*. I was of the idea that the purpose of the nginx reverse proxy was to allow the apps be reachable directly from port 80.

What could I be doing wrong? I sense its something simple in my setup. Thanks a lot in advance for any suggestion or advice.


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/46b8c0a9-23d3-41ff-b40d-e9ff61c8e32f%40continuum.io.

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

Hi,

You can start the Bokeh server with the --disable-index and --disable-index-redirect options if you want to make sure Bokeh server does not respond to "/".

Thanks,

Bryan

···

On Jan 3, 2019, at 13:25, [email protected] wrote:

Bryan, there is an index file that Nginx serves up if the Bokeh server is not running.

Once again, I made it work! The culprit seems to be the line:

try_files $uri $uri/ =404;

Commenting it out makes the Nginx proxy server work nicely, pointing to the Bokeh server. Meaning I can type in http://localhost and I can see my app running at localhost/myapp.

However there is slight issue with the case of running multiple apps. localhost now brings me to the Bokeh server landing page with the list of apps. How do I tweak the Nginx config file to show the index.html file instead? I am assuming the line I just commented out was meant to do that, going by the comments above it.

On Thursday, January 3, 2019 at 9:02:02 PM UTC, Bryan Van de ven wrote:
Hi,

You have both:

        location / { ... }

and:

        index index.html index.htm index.nginx-debian.html;

I'm not an nginx expert but these options seem incompatible? If the "index" statement takes precedence, and there is no index.html to return, that could explain the 404

Thanks,

Bryan

> On Jan 3, 2019, at 12:49, [email protected] wrote:
>
> Sarah, Thanks for your suggestion.
> I tried that but ran into issues starting the bokeh server on port 80 even with sudo.
>
> I might be wrong, but I thought the whole idea of using a proxy server like Nginx is to hide which port the bokeh server is running on when the outside users connect to port 80.
>
>
> On Tuesday, January 1, 2019 at 3:48:01 PM UTC, Sarah Bird wrote:
> Have you tried starting bokeh on port 80? (you might need sudo to do that)
>
> Or, what have you done to setup nginx to do the redirect? This isn't something I know a lot about but I found this stack overflow post.
> https://stackoverflow.com/questions/34744713/nginx-redirect-http-to-https-with-custom-port-server
>
>
> On Thursday, December 27, 2018 at 11:26:31 PM UTC-6, Kaushik Mallick wrote:
> First disclosure: I am not very knowledgeable in setting up reverse proxy etc.
>
> I am trying to bokeh serve multiple apps, lets say: appA, appB, appC. I have all my apps in separate folders. I have deployed all the apps by issuing:
>
> bokeh serve appA appB appC --port 5100
>
> When I go to http://localhost:5100, I see all my apps listed. Clicking each of them fire up the app in its own subfolder. For example I can see my appA working in localhost:5100/appA. So far so good.
>
> Now I want to set up nginx as reverse proxy to the bokeh server. I am following the instructions in https://bokeh.pydata.org/en/latest/docs/user_guide/server.html
>
> I have modified the /etc/nginx/sites-enabled/default file (attached) as instructed. After starting the nginx service I can go to http://localhost (port 80) and see all the apps listed there (great!). However when I click on each link for the apps, I get a 404 page error. The apps still function in localhost:5100/app*. I was of the idea that the purpose of the nginx reverse proxy was to allow the apps be reachable directly from port 80.
>
> What could I be doing wrong? I sense its something simple in my setup. Thanks a lot in advance for any suggestion or advice.
>
> --
> 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/46b8c0a9-23d3-41ff-b40d-e9ff61c8e32f%40continuum.io.
> For more options, visit https://groups.google.com/a/continuum.io/d/optout.

--
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/a32254da-ac8a-46da-94fc-f2905f0480be%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Bryan, I forgot about those options. Adding --disable-index --disable-index-redirect works nicely for the Bokeh server, not allowing localhost:5100 to show the list of apps.

However, I want users to go to the “/” and see an index.html file that Nginx serves up first (and not a Page 404). This is more of a Nginx question I guess.

···

On Thursday, January 3, 2019 at 9:28:50 PM UTC, Bryan Van de ven wrote:

Hi,

You can start the Bokeh server with the --disable-index and --disable-index-redirect options if you want to make sure Bokeh server does not respond to “/”.

Thanks,

Bryan

On Jan 3, 2019, at 13:25, [email protected] wrote:

Bryan, there is an index file that Nginx serves up if the Bokeh server is not running.

Once again, I made it work! The culprit seems to be the line:

try_files $uri $uri/ =404;

Commenting it out makes the Nginx proxy server work nicely, pointing to the Bokeh server. Meaning I can type in http://localhost and I can see my app running at localhost/myapp.

However there is slight issue with the case of running multiple apps. localhost now brings me to the Bokeh server landing page with the list of apps. How do I tweak the Nginx config file to show the index.html file instead? I am assuming the line I just commented out was meant to do that, going by the comments above it.

On Thursday, January 3, 2019 at 9:02:02 PM UTC, Bryan Van de ven wrote:

Hi,

You have both:

    location / { ... }

and:

    index index.html index.htm index.nginx-debian.html;

I’m not an nginx expert but these options seem incompatible? If the “index” statement takes precedence, and there is no index.html to return, that could explain the 404

Thanks,

Bryan

On Jan 3, 2019, at 12:49, [email protected] wrote:

Sarah, Thanks for your suggestion.
I tried that but ran into issues starting the bokeh server on port 80 even with sudo.

I might be wrong, but I thought the whole idea of using a proxy server like Nginx is to hide which port the bokeh server is running on when the outside users connect to port 80.

On Tuesday, January 1, 2019 at 3:48:01 PM UTC, Sarah Bird wrote:
Have you tried starting bokeh on port 80? (you might need sudo to do that)

Or, what have you done to setup nginx to do the redirect? This isn’t something I know a lot about but I found this stack overflow post.
https://stackoverflow.com/questions/34744713/nginx-redirect-http-to-https-with-custom-port-server

On Thursday, December 27, 2018 at 11:26:31 PM UTC-6, Kaushik Mallick wrote:
First disclosure: I am not very knowledgeable in setting up reverse proxy etc.

I am trying to bokeh serve multiple apps, lets say: appA, appB, appC. I have all my apps in separate folders. I have deployed all the apps by issuing:

bokeh serve appA appB appC --port 5100

When I go to http://localhost:5100, I see all my apps listed. Clicking each of them fire up the app in its own subfolder. For example I can see my appA working in localhost:5100/appA. So far so good.

Now I want to set up nginx as reverse proxy to the bokeh server. I am following the instructions in https://bokeh.pydata.org/en/latest/docs/user_guide/server.html

I have modified the /etc/nginx/sites-enabled/default file (attached) as instructed. After starting the nginx service I can go to http://localhost (port 80) and see all the apps listed there (great!). However when I click on each link for the apps, I get a 404 page error. The apps still function in localhost:5100/app*. I was of the idea that the purpose of the nginx reverse proxy was to allow the apps be reachable directly from port 80.

What could I be doing wrong? I sense its something simple in my setup. Thanks a lot in advance for any suggestion or advice.


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/46b8c0a9-23d3-41ff-b40d-e9ff61c8e32f%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.


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/a32254da-ac8a-46da-94fc-f2905f0480be%40continuum.io.

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

Hi,

Definitely more of an Nginx question. FWIW I'd possibly suggest you put the apps under some sort of prefix, e.g. /apps/app1, etc. Then I think you could avoid using try_files, since routes to /apps/ would be unambiguously different from / (but I am not an expert here).

Thanks,

Bryan

···

On Jan 3, 2019, at 13:49, [email protected] wrote:

Bryan, I forgot about those options. Adding --disable-index --disable-index-redirect works nicely for the Bokeh server, not allowing localhost:5100 to show the list of apps.
However, I want users to go to the "/" and see an index.html file that Nginx serves up first (and not a Page 404). This is more of a Nginx question I guess.

On Thursday, January 3, 2019 at 9:28:50 PM UTC, Bryan Van de ven wrote:
Hi,

You can start the Bokeh server with the --disable-index and --disable-index-redirect options if you want to make sure Bokeh server does not respond to "/".

Thanks,

Bryan

> On Jan 3, 2019, at 13:25, [email protected] wrote:
>
> Bryan, there is an index file that Nginx serves up if the Bokeh server is not running.
>
> Once again, I made it work! The culprit seems to be the line:
>
> try_files $uri $uri/ =404;
>
> Commenting it out makes the Nginx proxy server work nicely, pointing to the Bokeh server. Meaning I can type in http://localhost and I can see my app running at localhost/myapp.
>
> However there is slight issue with the case of running multiple apps. localhost now brings me to the Bokeh server landing page with the list of apps. How do I tweak the Nginx config file to show the index.html file instead? I am assuming the line I just commented out was meant to do that, going by the comments above it.
>
> On Thursday, January 3, 2019 at 9:02:02 PM UTC, Bryan Van de ven wrote:
> Hi,
>
> You have both:
>
> location / { ... }
>
> and:
>
> index index.html index.htm index.nginx-debian.html;
>
> I'm not an nginx expert but these options seem incompatible? If the "index" statement takes precedence, and there is no index.html to return, that could explain the 404
>
> Thanks,
>
> Bryan
>
> > On Jan 3, 2019, at 12:49, [email protected] wrote:
> >
> > Sarah, Thanks for your suggestion.
> > I tried that but ran into issues starting the bokeh server on port 80 even with sudo.
> >
> > I might be wrong, but I thought the whole idea of using a proxy server like Nginx is to hide which port the bokeh server is running on when the outside users connect to port 80.
> >
> >
> > On Tuesday, January 1, 2019 at 3:48:01 PM UTC, Sarah Bird wrote:
> > Have you tried starting bokeh on port 80? (you might need sudo to do that)
> >
> > Or, what have you done to setup nginx to do the redirect? This isn't something I know a lot about but I found this stack overflow post.
> > https://stackoverflow.com/questions/34744713/nginx-redirect-http-to-https-with-custom-port-server
> >
> >
> > On Thursday, December 27, 2018 at 11:26:31 PM UTC-6, Kaushik Mallick wrote:
> > First disclosure: I am not very knowledgeable in setting up reverse proxy etc.
> >
> > I am trying to bokeh serve multiple apps, lets say: appA, appB, appC. I have all my apps in separate folders. I have deployed all the apps by issuing:
> >
> > bokeh serve appA appB appC --port 5100
> >
> > When I go to http://localhost:5100, I see all my apps listed. Clicking each of them fire up the app in its own subfolder. For example I can see my appA working in localhost:5100/appA. So far so good.
> >
> > Now I want to set up nginx as reverse proxy to the bokeh server. I am following the instructions in https://bokeh.pydata.org/en/latest/docs/user_guide/server.html
> >
> > I have modified the /etc/nginx/sites-enabled/default file (attached) as instructed. After starting the nginx service I can go to http://localhost (port 80) and see all the apps listed there (great!). However when I click on each link for the apps, I get a 404 page error. The apps still function in localhost:5100/app*. I was of the idea that the purpose of the nginx reverse proxy was to allow the apps be reachable directly from port 80.
> >
> > What could I be doing wrong? I sense its something simple in my setup. Thanks a lot in advance for any suggestion or advice.
> >
> > --
> > 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/46b8c0a9-23d3-41ff-b40d-e9ff61c8e32f%40continuum.io.
> > For more options, visit https://groups.google.com/a/continuum.io/d/optout.
>
>
> --
> 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/a32254da-ac8a-46da-94fc-f2905f0480be%40continuum.io.
> For more options, visit https://groups.google.com/a/continuum.io/d/optout.

--
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/e987bc3d-70f4-4c5d-8ca9-ae947544a45d%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

That’s what I would suggest as well.

I had some trouble getting everything working with nginx as a reverse proxy as well, I’m glad to share what I can about what I cludged together (Disclaimer: I’m not a web developer).

I ran everything under docker-compose using three containers(bokeh server, flask-gunicorn, nginx proxy). I used the “–use-xheaders” and “–prefix /bokeh” options appended to my “bokeh serve …” command. I’ve attached my nginx config file and also an example of how I call the bokeh server from within flask. The bokeh app gets integrated in a web page just as suggested in the bokeh documentation using {{script | safe}}.

Best,

-Joe

web_app (1).conf (957 Bytes)

app (1).py (937 Bytes)

···

On Mon, Jan 7, 2019 at 2:39 AM Bryan Van de ven [email protected] wrote:

Hi,

Definitely more of an Nginx question. FWIW I’d possibly suggest you put the apps under some sort of prefix, e.g. /apps/app1, etc. Then I think you could avoid using try_files, since routes to /apps/ would be unambiguously different from / (but I am not an expert here).

Thanks,

Bryan

On Jan 3, 2019, at 13:49, [email protected] wrote:

Bryan, I forgot about those options. Adding --disable-index --disable-index-redirect works nicely for the Bokeh server, not allowing localhost:5100 to show the list of apps.

However, I want users to go to the “/” and see an index.html file that Nginx serves up first (and not a Page 404). This is more of a Nginx question I guess.

On Thursday, January 3, 2019 at 9:28:50 PM UTC, Bryan Van de ven wrote:

Hi,

You can start the Bokeh server with the --disable-index and --disable-index-redirect options if you want to make sure Bokeh server does not respond to “/”.

Thanks,

Bryan

On Jan 3, 2019, at 13:25, [email protected] wrote:

Bryan, there is an index file that Nginx serves up if the Bokeh server is not running.

Once again, I made it work! The culprit seems to be the line:

try_files $uri $uri/ =404;

Commenting it out makes the Nginx proxy server work nicely, pointing to the Bokeh server. Meaning I can type in http://localhost and I can see my app running at localhost/myapp.

However there is slight issue with the case of running multiple apps. localhost now brings me to the Bokeh server landing page with the list of apps. How do I tweak the Nginx config file to show the index.html file instead? I am assuming the line I just commented out was meant to do that, going by the comments above it.

On Thursday, January 3, 2019 at 9:02:02 PM UTC, Bryan Van de ven wrote:

Hi,

You have both:

    location / { ... }

and:

    index index.html index.htm index.nginx-debian.html;

I’m not an nginx expert but these options seem incompatible? If the “index” statement takes precedence, and there is no index.html to return, that could explain the 404

Thanks,

Bryan

On Jan 3, 2019, at 12:49, [email protected] wrote:

Sarah, Thanks for your suggestion.

I tried that but ran into issues starting the bokeh server on port 80 even with sudo.

I might be wrong, but I thought the whole idea of using a proxy server like Nginx is to hide which port the bokeh server is running on when the outside users connect to port 80.

On Tuesday, January 1, 2019 at 3:48:01 PM UTC, Sarah Bird wrote:

Have you tried starting bokeh on port 80? (you might need sudo to do that)

Or, what have you done to setup nginx to do the redirect? This isn’t something I know a lot about but I found this stack overflow post.

https://stackoverflow.com/questions/34744713/nginx-redirect-http-to-https-with-custom-port-server

On Thursday, December 27, 2018 at 11:26:31 PM UTC-6, Kaushik Mallick wrote:

First disclosure: I am not very knowledgeable in setting up reverse proxy etc.

I am trying to bokeh serve multiple apps, lets say: appA, appB, appC. I have all my apps in separate folders. I have deployed all the apps by issuing:

bokeh serve appA appB appC --port 5100

When I go to http://localhost:5100, I see all my apps listed. Clicking each of them fire up the app in its own subfolder. For example I can see my appA working in localhost:5100/appA. So far so good.

Now I want to set up nginx as reverse proxy to the bokeh server. I am following the instructions in https://bokeh.pydata.org/en/latest/docs/user_guide/server.html

I have modified the /etc/nginx/sites-enabled/default file (attached) as instructed. After starting the nginx service I can go to http://localhost (port 80) and see all the apps listed there (great!). However when I click on each link for the apps, I get a 404 page error. The apps still function in localhost:5100/app*. I was of the idea that the purpose of the nginx reverse proxy was to allow the apps be reachable directly from port 80.

What could I be doing wrong? I sense its something simple in my setup. Thanks a lot in advance for any suggestion or advice.

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/46b8c0a9-23d3-41ff-b40d-e9ff61c8e32f%40continuum.io.

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

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/a32254da-ac8a-46da-94fc-f2905f0480be%40continuum.io.

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

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/e987bc3d-70f4-4c5d-8ca9-ae947544a45d%40continuum.io.

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

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/E7315D53-5C63-44A4-BF1B-E3EFBD31430B%40anaconda.com.

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

Thanks to everyone for their help and suggestions. My problem is solved after following the directions similar to Bryan’s.

···

On Monday, January 7, 2019 at 12:39:03 AM UTC-7, Bryan Van de ven wrote:

Hi,

Definitely more of an Nginx question. FWIW I’d possibly suggest you put the apps under some sort of prefix, e.g. /apps/app1, etc. Then I think you could avoid using try_files, since routes to /apps/ would be unambiguously different from / (but I am not an expert here).

Thanks,

Bryan

On Jan 3, 2019, at 13:49, [email protected] wrote:

Bryan, I forgot about those options. Adding --disable-index --disable-index-redirect works nicely for the Bokeh server, not allowing localhost:5100 to show the list of apps.

However, I want users to go to the “/” and see an index.html file that Nginx serves up first (and not a Page 404). This is more of a Nginx question I guess.

On Thursday, January 3, 2019 at 9:28:50 PM UTC, Bryan Van de ven wrote:

Hi,

You can start the Bokeh server with the --disable-index and --disable-index-redirect options if you want to make sure Bokeh server does not respond to “/”.

Thanks,

Bryan

On Jan 3, 2019, at 13:25, [email protected] wrote:

Bryan, there is an index file that Nginx serves up if the Bokeh server is not running.

Once again, I made it work! The culprit seems to be the line:

try_files $uri $uri/ =404;

Commenting it out makes the Nginx proxy server work nicely, pointing to the Bokeh server. Meaning I can type in http://localhost and I can see my app running at localhost/myapp.

However there is slight issue with the case of running multiple apps. localhost now brings me to the Bokeh server landing page with the list of apps. How do I tweak the Nginx config file to show the index.html file instead? I am assuming the line I just commented out was meant to do that, going by the comments above it.

On Thursday, January 3, 2019 at 9:02:02 PM UTC, Bryan Van de ven wrote:
Hi,

You have both:

    location / { ... }

and:

    index index.html index.htm index.nginx-debian.html;

I’m not an nginx expert but these options seem incompatible? If the “index” statement takes precedence, and there is no index.html to return, that could explain the 404

Thanks,

Bryan

On Jan 3, 2019, at 12:49, [email protected] wrote:

Sarah, Thanks for your suggestion.
I tried that but ran into issues starting the bokeh server on port 80 even with sudo.

I might be wrong, but I thought the whole idea of using a proxy server like Nginx is to hide which port the bokeh server is running on when the outside users connect to port 80.

On Tuesday, January 1, 2019 at 3:48:01 PM UTC, Sarah Bird wrote:
Have you tried starting bokeh on port 80? (you might need sudo to do that)

Or, what have you done to setup nginx to do the redirect? This isn’t something I know a lot about but I found this stack overflow post.
https://stackoverflow.com/questions/34744713/nginx-redirect-http-to-https-with-custom-port-server

On Thursday, December 27, 2018 at 11:26:31 PM UTC-6, Kaushik Mallick wrote:
First disclosure: I am not very knowledgeable in setting up reverse proxy etc.

I am trying to bokeh serve multiple apps, lets say: appA, appB, appC. I have all my apps in separate folders. I have deployed all the apps by issuing:

bokeh serve appA appB appC --port 5100

When I go to http://localhost:5100, I see all my apps listed. Clicking each of them fire up the app in its own subfolder. For example I can see my appA working in localhost:5100/appA. So far so good.

Now I want to set up nginx as reverse proxy to the bokeh server. I am following the instructions in https://bokeh.pydata.org/en/latest/docs/user_guide/server.html

I have modified the /etc/nginx/sites-enabled/default file (attached) as instructed. After starting the nginx service I can go to http://localhost (port 80) and see all the apps listed there (great!). However when I click on each link for the apps, I get a 404 page error. The apps still function in localhost:5100/app*. I was of the idea that the purpose of the nginx reverse proxy was to allow the apps be reachable directly from port 80.

What could I be doing wrong? I sense its something simple in my setup. Thanks a lot in advance for any suggestion or advice.


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/46b8c0a9-23d3-41ff-b40d-e9ff61c8e32f%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.


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/a32254da-ac8a-46da-94fc-f2905f0480be%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.


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/e987bc3d-70f4-4c5d-8ca9-ae947544a45d%40continuum.io.

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

Good to hear that worked.

I was wondering if you could also launch each app under a different port and then make a separate app with a few buttons that hyperlink to the individual apps? I’m not sure if opening on different ports is necessary, but having a dedicated app to hyperlink might be interesting.

···

On Mon, Jan 7, 2019 at 8:19 AM [email protected] wrote:

Thanks to everyone for their help and suggestions. My problem is solved after following the directions similar to Bryan’s.

On Monday, January 7, 2019 at 12:39:03 AM UTC-7, Bryan Van de ven wrote:

Hi,

Definitely more of an Nginx question. FWIW I’d possibly suggest you put the apps under some sort of prefix, e.g. /apps/app1, etc. Then I think you could avoid using try_files, since routes to /apps/ would be unambiguously different from / (but I am not an expert here).

Thanks,

Bryan

On Jan 3, 2019, at 13:49, [email protected] wrote:

Bryan, I forgot about those options. Adding --disable-index --disable-index-redirect works nicely for the Bokeh server, not allowing localhost:5100 to show the list of apps.

However, I want users to go to the “/” and see an index.html file that Nginx serves up first (and not a Page 404). This is more of a Nginx question I guess.

On Thursday, January 3, 2019 at 9:28:50 PM UTC, Bryan Van de ven wrote:

Hi,

You can start the Bokeh server with the --disable-index and --disable-index-redirect options if you want to make sure Bokeh server does not respond to “/”.

Thanks,

Bryan

On Jan 3, 2019, at 13:25, [email protected]m wrote:

Bryan, there is an index file that Nginx serves up if the Bokeh server is not running.

Once again, I made it work! The culprit seems to be the line:

try_files $uri $uri/ =404;

Commenting it out makes the Nginx proxy server work nicely, pointing to the Bokeh server. Meaning I can type in http://localhost and I can see my app running at localhost/myapp.

However there is slight issue with the case of running multiple apps. localhost now brings me to the Bokeh server landing page with the list of apps. How do I tweak the Nginx config file to show the index.html file instead? I am assuming the line I just commented out was meant to do that, going by the comments above it.

On Thursday, January 3, 2019 at 9:02:02 PM UTC, Bryan Van de ven wrote:
Hi,

You have both:

    location / { ... }

and:

    index index.html index.htm index.nginx-debian.html;

I’m not an nginx expert but these options seem incompatible? If the “index” statement takes precedence, and there is no index.html to return, that could explain the 404

Thanks,

Bryan

On Jan 3, 2019, at 12:49, [email protected] wrote:

Sarah, Thanks for your suggestion.
I tried that but ran into issues starting the bokeh server on port 80 even with sudo.

I might be wrong, but I thought the whole idea of using a proxy server like Nginx is to hide which port the bokeh server is running on when the outside users connect to port 80.

On Tuesday, January 1, 2019 at 3:48:01 PM UTC, Sarah Bird wrote:
Have you tried starting bokeh on port 80? (you might need sudo to do that)

Or, what have you done to setup nginx to do the redirect? This isn’t something I know a lot about but I found this stack overflow post.
https://stackoverflow.com/questions/34744713/nginx-redirect-http-to-https-with-custom-port-server

On Thursday, December 27, 2018 at 11:26:31 PM UTC-6, Kaushik Mallick wrote:
First disclosure: I am not very knowledgeable in setting up reverse proxy etc.

I am trying to bokeh serve multiple apps, lets say: appA, appB, appC. I have all my apps in separate folders. I have deployed all the apps by issuing:

bokeh serve appA appB appC --port 5100

When I go to http://localhost:5100, I see all my apps listed. Clicking each of them fire up the app in its own subfolder. For example I can see my appA working in localhost:5100/appA. So far so good.

Now I want to set up nginx as reverse proxy to the bokeh server. I am following the instructions in https://bokeh.pydata.org/en/latest/docs/user_guide/server.html

I have modified the /etc/nginx/sites-enabled/default file (attached) as instructed. After starting the nginx service I can go to http://localhost (port 80) and see all the apps listed there (great!). However when I click on each link for the apps, I get a 404 page error. The apps still function in localhost:5100/app*. I was of the idea that the purpose of the nginx reverse proxy was to allow the apps be reachable directly from port 80.

What could I be doing wrong? I sense its something simple in my setup. Thanks a lot in advance for any suggestion or advice.


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/46b8c0a9-23d3-41ff-b40d-e9ff61c8e32f%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.


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/a32254da-ac8a-46da-94fc-f2905f0480be%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.


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/e987bc3d-70f4-4c5d-8ca9-ae947544a45d%40continuum.io.

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

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

To unsubscribe from this topic, visit https://groups.google.com/a/continuum.io/d/topic/bokeh/3MnO_y4NlIc/unsubscribe.

To unsubscribe from this group and all its topics, 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/69f910af-5db7-4f9f-91eb-0c08e54b4bf1%40continuum.io.

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

Joseph, Thanks for your guidance and for attaching the config files. I used your Nginx config file and it works nicely for proxy setup. However not so much luck with the bokeh app embedded inside the Flask.

Can you please confirm that the /MyApp link (as defined in your Flask configuration) actually resolves and shows the embedded Bokeh app? I just can’t get it to work.

And I am using the latest, Bokeh 1.0.3.

···

On Monday, January 7, 2019 at 4:27:40 AM UTC-7, Joseph St.Amand wrote:

That’s what I would suggest as well.

I had some trouble getting everything working with nginx as a reverse proxy as well, I’m glad to share what I can about what I cludged together (Disclaimer: I’m not a web developer).

I ran everything under docker-compose using three containers(bokeh server, flask-gunicorn, nginx proxy). I used the “–use-xheaders” and “–prefix /bokeh” options appended to my “bokeh serve …” command. I’ve attached my nginx config file and also an example of how I call the bokeh server from within flask. The bokeh app gets integrated in a web page just as suggested in the bokeh documentation using {{script | safe}}.

Best,

-Joe

On Mon, Jan 7, 2019 at 2:39 AM Bryan Van de ven [email protected] wrote:

Hi,

Definitely more of an Nginx question. FWIW I’d possibly suggest you put the apps under some sort of prefix, e.g. /apps/app1, etc. Then I think you could avoid using try_files, since routes to /apps/ would be unambiguously different from / (but I am not an expert here).

Thanks,

Bryan

On Jan 3, 2019, at 13:49, [email protected] wrote:

Bryan, I forgot about those options. Adding --disable-index --disable-index-redirect works nicely for the Bokeh server, not allowing localhost:5100 to show the list of apps.

However, I want users to go to the “/” and see an index.html file that Nginx serves up first (and not a Page 404). This is more of a Nginx question I guess.

On Thursday, January 3, 2019 at 9:28:50 PM UTC, Bryan Van de ven wrote:

Hi,

You can start the Bokeh server with the --disable-index and --disable-index-redirect options if you want to make sure Bokeh server does not respond to “/”.

Thanks,

Bryan

On Jan 3, 2019, at 13:25, [email protected] wrote:

Bryan, there is an index file that Nginx serves up if the Bokeh server is not running.

Once again, I made it work! The culprit seems to be the line:

try_files $uri $uri/ =404;

Commenting it out makes the Nginx proxy server work nicely, pointing to the Bokeh server. Meaning I can type in http://localhost and I can see my app running at localhost/myapp.

However there is slight issue with the case of running multiple apps. localhost now brings me to the Bokeh server landing page with the list of apps. How do I tweak the Nginx config file to show the index.html file instead? I am assuming the line I just commented out was meant to do that, going by the comments above it.

On Thursday, January 3, 2019 at 9:02:02 PM UTC, Bryan Van de ven wrote:

Hi,

You have both:

    location / { ... }

and:

    index index.html index.htm index.nginx-debian.html;

I’m not an nginx expert but these options seem incompatible? If the “index” statement takes precedence, and there is no index.html to return, that could explain the 404

Thanks,

Bryan

On Jan 3, 2019, at 12:49, [email protected] wrote:

Sarah, Thanks for your suggestion.

I tried that but ran into issues starting the bokeh server on port 80 even with sudo.

I might be wrong, but I thought the whole idea of using a proxy server like Nginx is to hide which port the bokeh server is running on when the outside users connect to port 80.

On Tuesday, January 1, 2019 at 3:48:01 PM UTC, Sarah Bird wrote:

Have you tried starting bokeh on port 80? (you might need sudo to do that)

Or, what have you done to setup nginx to do the redirect? This isn’t something I know a lot about but I found this stack overflow post.

https://stackoverflow.com/questions/34744713/nginx-redirect-http-to-https-with-custom-port-server

On Thursday, December 27, 2018 at 11:26:31 PM UTC-6, Kaushik Mallick wrote:

First disclosure: I am not very knowledgeable in setting up reverse proxy etc.

I am trying to bokeh serve multiple apps, lets say: appA, appB, appC. I have all my apps in separate folders. I have deployed all the apps by issuing:

bokeh serve appA appB appC --port 5100

When I go to http://localhost:5100, I see all my apps listed. Clicking each of them fire up the app in its own subfolder. For example I can see my appA working in localhost:5100/appA. So far so good.

Now I want to set up nginx as reverse proxy to the bokeh server. I am following the instructions in https://bokeh.pydata.org/en/latest/docs/user_guide/server.html

I have modified the /etc/nginx/sites-enabled/default file (attached) as instructed. After starting the nginx service I can go to http://localhost (port 80) and see all the apps listed there (great!). However when I click on each link for the apps, I get a 404 page error. The apps still function in localhost:5100/app*. I was of the idea that the purpose of the nginx reverse proxy was to allow the apps be reachable directly from port 80.

What could I be doing wrong? I sense its something simple in my setup. Thanks a lot in advance for any suggestion or advice.

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/46b8c0a9-23d3-41ff-b40d-e9ff61c8e32f%40continuum.io.

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

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/a32254da-ac8a-46da-94fc-f2905f0480be%40continuum.io.

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

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/e987bc3d-70f4-4c5d-8ca9-ae947544a45d%40continuum.io.

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

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/E7315D53-5C63-44A4-BF1B-E3EFBD31430B%40anaconda.com.

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

Yes it definitely works great for what I am doing here – on my website I have four separate bokeh apps embedding in various webpages, it’s been running good for about a month now with no issues. All using the same techniques in the flask app file I had sent.

Since you aren’t using docker, you will have to change the app.py file for your own setup and fill in all the environment variables, rename app route and bokeh_app, etc …

I’d check in your flask app that the host_url and app_url variables are what you expect. Also keep an eye on the bokeh logs to check that the request is reaching your bokeh server and that it is responding.

Best,

-Joe

···

On Wed, Jan 9, 2019 at 3:28 AM [email protected] wrote:

Joseph, Thanks for your guidance and for attaching the config files. I used your Nginx config file and it works nicely for proxy setup. However not so much luck with the bokeh app embedded inside the Flask.

Can you please confirm that the /MyApp link (as defined in your Flask configuration) actually resolves and shows the embedded Bokeh app? I just can’t get it to work.

And I am using the latest, Bokeh 1.0.3.

On Monday, January 7, 2019 at 4:27:40 AM UTC-7, Joseph St.Amand wrote:

That’s what I would suggest as well.

I had some trouble getting everything working with nginx as a reverse proxy as well, I’m glad to share what I can about what I cludged together (Disclaimer: I’m not a web developer).

I ran everything under docker-compose using three containers(bokeh server, flask-gunicorn, nginx proxy). I used the “–use-xheaders” and “–prefix /bokeh” options appended to my “bokeh serve …” command. I’ve attached my nginx config file and also an example of how I call the bokeh server from within flask. The bokeh app gets integrated in a web page just as suggested in the bokeh documentation using {{script | safe}}.

Best,

-Joe

On Mon, Jan 7, 2019 at 2:39 AM Bryan Van de ven [email protected] wrote:

Hi,

Definitely more of an Nginx question. FWIW I’d possibly suggest you put the apps under some sort of prefix, e.g. /apps/app1, etc. Then I think you could avoid using try_files, since routes to /apps/ would be unambiguously different from / (but I am not an expert here).

Thanks,

Bryan

On Jan 3, 2019, at 13:49, [email protected] wrote:

Bryan, I forgot about those options. Adding --disable-index --disable-index-redirect works nicely for the Bokeh server, not allowing localhost:5100 to show the list of apps.

However, I want users to go to the “/” and see an index.html file that Nginx serves up first (and not a Page 404). This is more of a Nginx question I guess.

On Thursday, January 3, 2019 at 9:28:50 PM UTC, Bryan Van de ven wrote:

Hi,

You can start the Bokeh server with the --disable-index and --disable-index-redirect options if you want to make sure Bokeh server does not respond to “/”.

Thanks,

Bryan

On Jan 3, 2019, at 13:25, [email protected] wrote:

Bryan, there is an index file that Nginx serves up if the Bokeh server is not running.

Once again, I made it work! The culprit seems to be the line:

try_files $uri $uri/ =404;

Commenting it out makes the Nginx proxy server work nicely, pointing to the Bokeh server. Meaning I can type in http://localhost and I can see my app running at localhost/myapp.

However there is slight issue with the case of running multiple apps. localhost now brings me to the Bokeh server landing page with the list of apps. How do I tweak the Nginx config file to show the index.html file instead? I am assuming the line I just commented out was meant to do that, going by the comments above it.

On Thursday, January 3, 2019 at 9:02:02 PM UTC, Bryan Van de ven wrote:

Hi,

You have both:

    location / { ... }

and:

    index index.html index.htm index.nginx-debian.html;

I’m not an nginx expert but these options seem incompatible? If the “index” statement takes precedence, and there is no index.html to return, that could explain the 404

Thanks,

Bryan

On Jan 3, 2019, at 12:49, [email protected] wrote:

Sarah, Thanks for your suggestion.

I tried that but ran into issues starting the bokeh server on port 80 even with sudo.

I might be wrong, but I thought the whole idea of using a proxy server like Nginx is to hide which port the bokeh server is running on when the outside users connect to port 80.

On Tuesday, January 1, 2019 at 3:48:01 PM UTC, Sarah Bird wrote:

Have you tried starting bokeh on port 80? (you might need sudo to do that)

Or, what have you done to setup nginx to do the redirect? This isn’t something I know a lot about but I found this stack overflow post.

https://stackoverflow.com/questions/34744713/nginx-redirect-http-to-https-with-custom-port-server

On Thursday, December 27, 2018 at 11:26:31 PM UTC-6, Kaushik Mallick wrote:

First disclosure: I am not very knowledgeable in setting up reverse proxy etc.

I am trying to bokeh serve multiple apps, lets say: appA, appB, appC. I have all my apps in separate folders. I have deployed all the apps by issuing:

bokeh serve appA appB appC --port 5100

When I go to http://localhost:5100, I see all my apps listed. Clicking each of them fire up the app in its own subfolder. For example I can see my appA working in localhost:5100/appA. So far so good.

Now I want to set up nginx as reverse proxy to the bokeh server. I am following the instructions in https://bokeh.pydata.org/en/latest/docs/user_guide/server.html

I have modified the /etc/nginx/sites-enabled/default file (attached) as instructed. After starting the nginx service I can go to http://localhost (port 80) and see all the apps listed there (great!). However when I click on each link for the apps, I get a 404 page error. The apps still function in localhost:5100/app*. I was of the idea that the purpose of the nginx reverse proxy was to allow the apps be reachable directly from port 80.

What could I be doing wrong? I sense its something simple in my setup. Thanks a lot in advance for any suggestion or advice.

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/46b8c0a9-23d3-41ff-b40d-e9ff61c8e32f%40continuum.io.

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

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/a32254da-ac8a-46da-94fc-f2905f0480be%40continuum.io.

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

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/e987bc3d-70f4-4c5d-8ca9-ae947544a45d%40continuum.io.

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

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/E7315D53-5C63-44A4-BF1B-E3EFBD31430B%40anaconda.com.

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

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/679cb420-c9f4-428f-b7a6-4712f0bf1b16%40continuum.io.

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

Joe
Appreciate your help! I am not using docker but I do have a virtualenv that I am launching my Flask based website from. I adapted my Flask app route from what you have provided, but its much more straightforward to carry out my initial testing within the local network:

@app.route(’/test’)

def test():

bokeh_app = 'bokeh/myapp'    
app_url = 'http://%s:%s/%s' % ('127.0.0.1', '5100', bokeh_app)

session = pull_session(url=app_url)
script = server_session(None, session.id, url=app_url)
return render_template("test.html", script=script, template="Flask")

``

My Nginx is setup similar to yours. When I call my bokeh app with “–prefix /bokeh” option, the page link to /test (localhost/test) shows all the headers and content except the embedded bokeh app. This is what I use for starting my Bokeh server:

bokeh serve myapp --port 5100 --allow-websocket-origin=’*’

``

However, starting the bokeh server without the “–prefix /bokeh” option and changing the variable

bokeh_app = ‘myapp’

``

in Flask shows the embedded Bokeh app fine. I am struggling to find what is different in my setup from yours, since I would like all my Bokeh apps to appear under the /bokeh.

Also do you mind advising on what to set for the environmental variables like ‘BOKEH_SERVER_HOSTNAME’ and ‘HOST_IP’ just so that I am clear? Thanks again.

Yes it definitely works great for what I am doing here -- on my website I have four separate bokeh apps embedding in various webpages, it's been running good for about a month now with no issues. All using the same techniques in the flask app file I had sent.

Since you aren't using docker, you will have to change the app.py file for your own setup and fill in all the environment variables, rename app route and bokeh_app, etc ...

I'd check in your flask app that the host_url and app_url variables are what you expect. Also keep an eye on the bokeh logs to check that the request is reaching your bokeh server and that it is responding.

Best,
-Joe


    Joseph, Thanks for your guidance and for attaching the config files. I used your Nginx config file and it works nicely for proxy setup. However not so much luck with the bokeh app embedded inside the Flask.

    Can you please confirm that the /MyApp link (as defined in your Flask configuration) actually resolves and shows the embedded Bokeh app?  I just can't get it to work.

    And I am using the latest, Bokeh 1.0.3.


        That's what I would suggest as well.

        I had some trouble getting everything working with nginx as a reverse proxy as well, I'm glad to share what I can about what I cludged together (Disclaimer: I'm not a web developer).

        I ran everything under docker-compose using three containers(bokeh server, flask-gunicorn, nginx proxy). I used the "--use-xheaders" and "--prefix /bokeh" options appended to my "bokeh serve ...."  command. I've attached my nginx config file and also an example of how I call the bokeh server from within flask. The bokeh app gets integrated in a web page just as suggested in the bokeh documentation using {{script | safe}}.

        Best,

        -Joe


            Hi,

            Definitely more of an Nginx question. FWIW I'd possibly suggest you put the apps under some sort of prefix, e.g. /apps/app1, etc. Then I think you could avoid using try_files, since routes to /apps/ would be unambiguously different from / (but I am not an expert here).

            Thanks,

            Bryan
···

On Wednesday, January 9, 2019 at 1:39:11 PM UTC, Joseph St.Amand wrote:
On Wed, Jan 9, 2019 at 3:28 AM [email protected] wrote:
On Monday, January 7, 2019 at 4:27:40 AM UTC-7, Joseph St.Amand wrote:
On Mon, Jan 7, 2019 at 2:39 AM Bryan Van de ven [email protected] wrote:

            > On Jan 3, 2019, at 13:49, [email protected] wrote:
            >
            > Bryan, I forgot about those options. Adding --disable-index --disable-index-redirect works nicely for the Bokeh server, not allowing  localhost:5100 to show the list of apps.
            > However, I want users to go to the "/" and see an index.html file that Nginx serves up first (and not a Page 404). This is more of a Nginx question I guess.
            >
            > On Thursday, January 3, 2019 at 9:28:50 PM UTC, Bryan Van de ven wrote:
            > Hi,
            >
            > You can start the Bokeh server with the --disable-index and --disable-index-redirect options if you want to make sure Bokeh server does not respond to "/".
            >
            > Thanks,
            >
            > Bryan
            >
            > > On Jan 3, 2019, at 13:25, [email protected] wrote:
            > >
            > > Bryan, there is an index file that Nginx serves up if the Bokeh server is not running.
            > >
            > > Once again, I made it work! The culprit seems to be the line:
            > >
            > > try_files $uri $uri/ =404;
            > >
            > > Commenting it out makes the Nginx proxy server work nicely, pointing to the Bokeh server. Meaning I can type in http://localhost and I can see my app running at localhost/myapp.
            > >
            > > However there is slight issue with the case of running multiple apps. localhost now brings me to the Bokeh server landing page with the list of apps. How do I tweak the Nginx config file to show the index.html file instead? I am assuming the line I just commented out was meant to do that, going by the comments above it.
            > >
            > > On Thursday, January 3, 2019 at 9:02:02 PM UTC, Bryan Van de ven wrote:
            > > Hi,
            > >
            > > You have both:
            > >
            > >         location / { ... }
            > >
            > > and:
            > >
            > >         index index.html index.htm index.nginx-debian.html;
            > >
            > > I'm not an nginx expert but these options seem incompatible? If the "index" statement takes precedence, and there is no index.html to return, that could explain the 404
            > >
            > > Thanks,
            > >
            > > Bryan
            > >
            > > > On Jan 3, 2019, at 12:49, [email protected] wrote:
            > > >
            > > > Sarah, Thanks for your suggestion.
            > > > I tried that but ran into issues starting the bokeh server on port 80 even with sudo.
            > > >
            > > > I might be wrong, but I thought the whole idea of using a proxy server like Nginx is to hide which port the bokeh server is running on when the outside users connect to port 80.
            > > >
            > > >
            > > > On Tuesday, January 1, 2019 at 3:48:01 PM UTC, Sarah Bird wrote:
            > > > Have you tried starting bokeh on port 80? (you might need sudo to do that)
            > > >
            > > > Or, what have you done to setup nginx to do the redirect? This isn't something I know a lot about but I found this stack overflow post.
            > > > https://stackoverflow.com/questions/34744713/nginx-redirect-http-to-https-with-custom-port-server
            > > >
            > > >
            > > > On Thursday, December 27, 2018 at 11:26:31 PM UTC-6, Kaushik Mallick wrote:
            > > > First disclosure: I am not very knowledgeable in setting up reverse proxy etc.
            > > >
            > > > I am trying to bokeh serve multiple apps, lets say: appA, appB, appC. I have all my apps in separate folders. I have deployed all the apps by issuing:
            > > >
            > > > bokeh serve appA appB appC --port 5100
            > > >
            > > > When I go to http://localhost:5100, I see all my apps listed. Clicking each of them fire up the app in its own subfolder. For example I can see my appA working in localhost:5100/appA. So far so good.
            > > >
            > > > Now I want to set up  nginx as reverse proxy to the bokeh server. I am following the instructions in https://bokeh.pydata.org/en/latest/docs/user_guide/server.html
            > > >
            > > > I have modified the /etc/nginx/sites-enabled/default file (attached) as instructed. After starting the nginx service I can go to http://localhost (port 80) and see all the apps listed there (great!). However when I click on each link for the apps, I get a 404 page error. The apps still function in localhost:5100/app*. I was of the idea that the purpose of the nginx reverse proxy was to allow the apps be reachable directly from port 80.
            > > >
            > > > What could I be doing wrong? I sense its something simple in my setup. Thanks a lot in advance for any suggestion or advice.
            > > >
            > > > --
            > > > 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/46b8c0a9-23d3-41ff-b40d-e9ff61c8e32f%40continuum.io.
            > > > For more options, visit https://groups.google.com/a/continuum.io/d/optout.
            > >
            > >
            > > --
            > > 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/a32254da-ac8a-46da-94fc-f2905f0480be%40continuum.io.
            > > For more options, visit https://groups.google.com/a/continuum.io/d/optout.
            >
            >
            > --
            > 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/e987bc3d-70f4-4c5d-8ca9-ae947544a45d%40continuum.io.
            > For more options, visit https://groups.google.com/a/continuum.io/d/optout.

            --
            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/E7315D53-5C63-44A4-BF1B-E3EFBD31430B%40anaconda.com.
            For more options, visit https://groups.google.com/a/continuum.io/d/optout.

    --
    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/679cb420-c9f4-428f-b7a6-4712f0bf1b16%40continuum.io.
    For more options, visit https://groups.google.com/a/continuum.io/d/optout.

On Wednesday, January 9, 2019 at 6:39:11 AM UTC-7, Joseph St.Amand wrote:

Yes it definitely works great for what I am doing here – on my website I have four separate bokeh apps embedding in various webpages, it’s been running good for about a month now with no issues. All using the same techniques in the flask app file I had sent.

Since you aren’t using docker, you will have to change the app.py file for your own setup and fill in all the environment variables, rename app route and bokeh_app, etc …

I’d check in your flask app that the host_url and app_url variables are what you expect. Also keep an eye on the bokeh logs to check that the request is reaching your bokeh server and that it is responding.

Best,

-Joe

On Wed, Jan 9, 2019 at 3:28 AM [email protected] wrote:

Joseph, Thanks for your guidance and for attaching the config files. I used your Nginx config file and it works nicely for proxy setup. However not so much luck with the bokeh app embedded inside the Flask.

Can you please confirm that the /MyApp link (as defined in your Flask configuration) actually resolves and shows the embedded Bokeh app? I just can’t get it to work.

And I am using the latest, Bokeh 1.0.3.

On Monday, January 7, 2019 at 4:27:40 AM UTC-7, Joseph St.Amand wrote:

That’s what I would suggest as well.

I had some trouble getting everything working with nginx as a reverse proxy as well, I’m glad to share what I can about what I cludged together (Disclaimer: I’m not a web developer).

I ran everything under docker-compose using three containers(bokeh server, flask-gunicorn, nginx proxy). I used the “–use-xheaders” and “–prefix /bokeh” options appended to my “bokeh serve …” command. I’ve attached my nginx config file and also an example of how I call the bokeh server from within flask. The bokeh app gets integrated in a web page just as suggested in the bokeh documentation using {{script | safe}}.

Best,

-Joe

On Mon, Jan 7, 2019 at 2:39 AM Bryan Van de ven [email protected] wrote:

Hi,

Definitely more of an Nginx question. FWIW I’d possibly suggest you put the apps under some sort of prefix, e.g. /apps/app1, etc. Then I think you could avoid using try_files, since routes to /apps/ would be unambiguously different from / (but I am not an expert here).

Thanks,

Bryan

On Jan 3, 2019, at 13:49, [email protected] wrote:

Bryan, I forgot about those options. Adding --disable-index --disable-index-redirect works nicely for the Bokeh server, not allowing localhost:5100 to show the list of apps.

However, I want users to go to the “/” and see an index.html file that Nginx serves up first (and not a Page 404). This is more of a Nginx question I guess.

On Thursday, January 3, 2019 at 9:28:50 PM UTC, Bryan Van de ven wrote:

Hi,

You can start the Bokeh server with the --disable-index and --disable-index-redirect options if you want to make sure Bokeh server does not respond to “/”.

Thanks,

Bryan

On Jan 3, 2019, at 13:25, [email protected] wrote:

Bryan, there is an index file that Nginx serves up if the Bokeh server is not running.

Once again, I made it work! The culprit seems to be the line:

try_files $uri $uri/ =404;

Commenting it out makes the Nginx proxy server work nicely, pointing to the Bokeh server. Meaning I can type in http://localhost and I can see my app running at localhost/myapp.

However there is slight issue with the case of running multiple apps. localhost now brings me to the Bokeh server landing page with the list of apps. How do I tweak the Nginx config file to show the index.html file instead? I am assuming the line I just commented out was meant to do that, going by the comments above it.

On Thursday, January 3, 2019 at 9:02:02 PM UTC, Bryan Van de ven wrote:

Hi,

You have both:

    location / { ... }

and:

    index index.html index.htm index.nginx-debian.html;

I’m not an nginx expert but these options seem incompatible? If the “index” statement takes precedence, and there is no index.html to return, that could explain the 404

Thanks,

Bryan

On Jan 3, 2019, at 12:49, [email protected] wrote:

Sarah, Thanks for your suggestion.

I tried that but ran into issues starting the bokeh server on port 80 even with sudo.

I might be wrong, but I thought the whole idea of using a proxy server like Nginx is to hide which port the bokeh server is running on when the outside users connect to port 80.

On Tuesday, January 1, 2019 at 3:48:01 PM UTC, Sarah Bird wrote:

Have you tried starting bokeh on port 80? (you might need sudo to do that)

Or, what have you done to setup nginx to do the redirect? This isn’t something I know a lot about but I found this stack overflow post.

https://stackoverflow.com/questions/34744713/nginx-redirect-http-to-https-with-custom-port-server

On Thursday, December 27, 2018 at 11:26:31 PM UTC-6, Kaushik Mallick wrote:

First disclosure: I am not very knowledgeable in setting up reverse proxy etc.

I am trying to bokeh serve multiple apps, lets say: appA, appB, appC. I have all my apps in separate folders. I have deployed all the apps by issuing:

bokeh serve appA appB appC --port 5100

When I go to http://localhost:5100, I see all my apps listed. Clicking each of them fire up the app in its own subfolder. For example I can see my appA working in localhost:5100/appA. So far so good.

Now I want to set up nginx as reverse proxy to the bokeh server. I am following the instructions in https://bokeh.pydata.org/en/latest/docs/user_guide/server.html

I have modified the /etc/nginx/sites-enabled/default file (attached) as instructed. After starting the nginx service I can go to http://localhost (port 80) and see all the apps listed there (great!). However when I click on each link for the apps, I get a 404 page error. The apps still function in localhost:5100/app*. I was of the idea that the purpose of the nginx reverse proxy was to allow the apps be reachable directly from port 80.

What could I be doing wrong? I sense its something simple in my setup. Thanks a lot in advance for any suggestion or advice.

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/46b8c0a9-23d3-41ff-b40d-e9ff61c8e32f%40continuum.io.

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

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/a32254da-ac8a-46da-94fc-f2905f0480be%40continuum.io.

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

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/e987bc3d-70f4-4c5d-8ca9-ae947544a45d%40continuum.io.

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

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/E7315D53-5C63-44A4-BF1B-E3EFBD31430B%40anaconda.com.

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

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/679cb420-c9f4-428f-b7a6-4712f0bf1b16%40continuum.io.

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

One difference I noticed is that I use the “–use-xheaders” option when starting my bokeh server.

I have those environment variables set to:

BOKEH_SERVER_HOSTNAME = bokeh // this is the name of the docker container running my bokeh server, it gets resolved to an IP in the docker network (it’s 172.18.0.something)

HOST_IP = 10.240.0.10 // this is the local network IP of the machine hosting the docker apps.

Best,

-Joe

···

On Wed, Jan 9, 2019 at 7:27 PM [email protected] wrote:

Joe
Appreciate your help! I am not using docker but I do have a virtualenv that I am launching my Flask based website from. I adapted my Flask app route from what you have provided, but its much more straightforward to carry out my initial testing within the local network:

@app.route(’/test’)

def test():

bokeh_app = 'bokeh/myapp'    
app_url = 'http://%s:%s/%s' % ('127.0.0.1', '5100', bokeh_app)

session = pull_session(url=app_url)
script = server_session(None, session.id, url=app_url)
return render_template("test.html", script=script, template="Flask")

``

My Nginx is setup similar to yours. When I call my bokeh app with “–prefix /bokeh” option, the page link to /test (localhost/test) shows all the headers and content except the embedded bokeh app. This is what I use for starting my Bokeh server:

bokeh serve myapp --port 5100 --allow-websocket-origin=’*’

``

However, starting the bokeh server without the “–prefix /bokeh” option and changing the variable

bokeh_app = ‘myapp’

``

in Flask shows the embedded Bokeh app fine. I am struggling to find what is different in my setup from yours, since I would like all my Bokeh apps to appear under the /bokeh.

Also do you mind advising on what to set for the environmental variables like ‘BOKEH_SERVER_HOSTNAME’ and ‘HOST_IP’ just so that I am clear? Thanks again.

On Wednesday, January 9, 2019 at 1:39:11 PM UTC, Joseph St.Amand wrote:

Yes it definitely works great for what I am doing here -- on my website I have four separate bokeh apps embedding in various webpages, it's been running good for about a month now with no issues. All using the same techniques in the flask app file I had sent.

Since you aren't using docker, you will have to change the app.py file for your own setup and fill in all the environment variables, rename app route and bokeh_app, etc ...

I'd check in your flask app that the host_url and app_url variables are what you expect. Also keep an eye on the bokeh logs to check that the request is reaching your bokeh server and that it is responding.

Best,
-Joe






On Wed, Jan 9, 2019 at 3:28 AM <[email protected]> wrote:

    Joseph, Thanks for your guidance and for attaching the config files. I used your Nginx config file and it works nicely for proxy setup. However not so much luck with the bokeh app embedded inside the Flask.

    Can you please confirm that the /MyApp link (as defined in your Flask configuration) actually resolves and shows the embedded Bokeh app?  I just can't get it to work.

    And I am using the latest, Bokeh 1.0.3.

    On Monday, January 7, 2019 at 4:27:40 AM UTC-7, Joseph St.Amand wrote:

        That's what I would suggest as well.

        I had some trouble getting everything working with nginx as a reverse proxy as well, I'm glad to share what I can about what I cludged together (Disclaimer: I'm not a web developer).

        I ran everything under docker-compose using three containers(bokeh server, flask-gunicorn, nginx proxy). I used the "--use-xheaders" and "--prefix /bokeh" options appended to my "bokeh serve ...."  command. I've attached my nginx config file and also an example of how I call the bokeh server from within flask. The bokeh app gets integrated in a web page just as suggested in the bokeh documentation using {{script | safe}}.

        Best,

        -Joe



        On Mon, Jan 7, 2019 at 2:39 AM Bryan Van de ven <[email protected]> wrote:

            Hi,

            Definitely more of an Nginx question. FWIW I'd possibly suggest you put the apps under some sort of prefix, e.g. /apps/app1, etc. Then I think you could avoid using try_files, since routes to /apps/ would be unambiguously different from / (but I am not an expert here).


            Thanks,

            Bryan

            > On Jan 3, 2019, at 13:49, [email protected] wrote:
            >
            > Bryan, I forgot about those options. Adding --disable-index --disable-index-redirect works nicely for the Bokeh server, not allowing  localhost:5100 to show the list of apps.
            > However, I want users to go to the "/" and see an index.html file that Nginx serves up first (and not a Page 404). This is more of a Nginx question I guess.
            >
            > On Thursday, January 3, 2019 at 9:28:50 PM UTC, Bryan Van de ven wrote:
            > Hi,
            >
            > You can start the Bokeh server with the --disable-index and --disable-index-redirect options if you want to make sure Bokeh server does not respond to "/".
            >
            > Thanks,
            >
            > Bryan
            >
            > > On Jan 3, 2019, at 13:25, [email protected] wrote:
            > >
            > > Bryan, there is an index file that Nginx serves up if the Bokeh server is not running.
            > >
            > > Once again, I made it work! The culprit seems to be the line:
            > >
            > > try_files $uri $uri/ =404;
            > >
            > > Commenting it out makes the Nginx proxy server work nicely, pointing to the Bokeh server. Meaning I can type in [http://localhost](http://localhost) and I can see my app running at localhost/myapp.
            > >
            > > However there is slight issue with the case of running multiple apps. localhost now brings me to the Bokeh server landing page with the list of apps. How do I tweak the Nginx config file to show the index.html file instead? I am assuming the line I just commented out was meant to do that, going by the comments above it.
            > >
            > > On Thursday, January 3, 2019 at 9:02:02 PM UTC, Bryan Van de ven wrote:
            > > Hi,
            > >
            > > You have both:
            > >
            > >         location / { ... }
            > >
            > > and:
            > >
            > >         index index.html index.htm index.nginx-debian.html;
            > >
            > > I'm not an nginx expert but these options seem incompatible? If the "index" statement takes precedence, and there is no index.html to return, that could explain the 404
            > >
            > > Thanks,
            > >
            > > Bryan
            > >
            > > > On Jan 3, 2019, at 12:49, [email protected] wrote:
            > > >
            > > > Sarah, Thanks for your suggestion.
            > > > I tried that but ran into issues starting the bokeh server on port 80 even with sudo.
            > > >
            > > > I might be wrong, but I thought the whole idea of using a proxy server like Nginx is to hide which port the bokeh server is running on when the outside users connect to port 80.
            > > >
            > > >
            > > > On Tuesday, January 1, 2019 at 3:48:01 PM UTC, Sarah Bird wrote:
            > > > Have you tried starting bokeh on port 80? (you might need sudo to do that)
            > > >
            > > > Or, what have you done to setup nginx to do the redirect? This isn't something I know a lot about but I found this stack overflow post.
            > > > [https://stackoverflow.com/questions/34744713/nginx-redirect-http-to-https-with-custom-port-server](https://stackoverflow.com/questions/34744713/nginx-redirect-http-to-https-with-custom-port-server)
            > > >
            > > >
            > > > On Thursday, December 27, 2018 at 11:26:31 PM UTC-6, Kaushik Mallick wrote:
            > > > First disclosure: I am not very knowledgeable in setting up reverse proxy etc.
            > > >
            > > > I am trying to bokeh serve multiple apps, lets say: appA, appB, appC. I have all my apps in separate folders. I have deployed all the apps by issuing:
            > > >
            > > > bokeh serve appA appB appC --port 5100
            > > >
            > > > When I go to [http://localhost:5100](http://localhost:5100), I see all my apps listed. Clicking each of them fire up the app in its own subfolder. For example I can see my appA working in localhost:5100/appA. So far so good.
            > > >
            > > > Now I want to set up  nginx as reverse proxy to the bokeh server. I am following the instructions in [https://bokeh.pydata.org/en/latest/docs/user_guide/server.html](https://bokeh.pydata.org/en/latest/docs/user_guide/server.html)
            > > >
            > > > I have modified the /etc/nginx/sites-enabled/default file (attached) as instructed. After starting the nginx service I can go to [http://localhost](http://localhost) (port 80) and see all the apps listed there (great!). However when I click on each link for the apps, I get a 404 page error. The apps still function in localhost:5100/app*. I was of the idea that the purpose of the nginx reverse proxy was to allow the apps be reachable directly from port 80.
            > > >
            > > > What could I be doing wrong? I sense its something simple in my setup. Thanks a lot in advance for any suggestion or advice.
            > > >
            > > > --
            > > > 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/46b8c0a9-23d3-41ff-b40d-e9ff61c8e32f%40continuum.io](https://groups.google.com/a/continuum.io/d/msgid/bokeh/46b8c0a9-23d3-41ff-b40d-e9ff61c8e32f%40continuum.io).
            > > > For more options, visit [https://groups.google.com/a/continuum.io/d/optout](https://groups.google.com/a/continuum.io/d/optout).
            > >
            > >
            > > --
            > > 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/a32254da-ac8a-46da-94fc-f2905f0480be%40continuum.io](https://groups.google.com/a/continuum.io/d/msgid/bokeh/a32254da-ac8a-46da-94fc-f2905f0480be%40continuum.io).
            > > For more options, visit [https://groups.google.com/a/continuum.io/d/optout](https://groups.google.com/a/continuum.io/d/optout).
            >
            >
            > --
            > 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/e987bc3d-70f4-4c5d-8ca9-ae947544a45d%40continuum.io](https://groups.google.com/a/continuum.io/d/msgid/bokeh/e987bc3d-70f4-4c5d-8ca9-ae947544a45d%40continuum.io).
            > For more options, visit [https://groups.google.com/a/continuum.io/d/optout](https://groups.google.com/a/continuum.io/d/optout).

            --
            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/E7315D53-5C63-44A4-BF1B-E3EFBD31430B%40anaconda.com](https://groups.google.com/a/continuum.io/d/msgid/bokeh/E7315D53-5C63-44A4-BF1B-E3EFBD31430B%40anaconda.com).
            For more options, visit [https://groups.google.com/a/continuum.io/d/optout](https://groups.google.com/a/continuum.io/d/optout).

    --
    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/679cb420-c9f4-428f-b7a6-4712f0bf1b16%40continuum.io](https://groups.google.com/a/continuum.io/d/msgid/bokeh/679cb420-c9f4-428f-b7a6-4712f0bf1b16%40continuum.io).
    For more options, visit [https://groups.google.com/a/continuum.io/d/optout](https://groups.google.com/a/continuum.io/d/optout).

On Wednesday, January 9, 2019 at 6:39:11 AM UTC-7, Joseph St.Amand wrote:

Yes it definitely works great for what I am doing here – on my website I have four separate bokeh apps embedding in various webpages, it’s been running good for about a month now with no issues. All using the same techniques in the flask app file I had sent.

Since you aren’t using docker, you will have to change the app.py file for your own setup and fill in all the environment variables, rename app route and bokeh_app, etc …

I’d check in your flask app that the host_url and app_url variables are what you expect. Also keep an eye on the bokeh logs to check that the request is reaching your bokeh server and that it is responding.

Best,

-Joe

On Wed, Jan 9, 2019 at 3:28 AM [email protected] wrote:

Joseph, Thanks for your guidance and for attaching the config files. I used your Nginx config file and it works nicely for proxy setup. However not so much luck with the bokeh app embedded inside the Flask.

Can you please confirm that the /MyApp link (as defined in your Flask configuration) actually resolves and shows the embedded Bokeh app? I just can’t get it to work.

And I am using the latest, Bokeh 1.0.3.

On Monday, January 7, 2019 at 4:27:40 AM UTC-7, Joseph St.Amand wrote:

That’s what I would suggest as well.

I had some trouble getting everything working with nginx as a reverse proxy as well, I’m glad to share what I can about what I cludged together (Disclaimer: I’m not a web developer).

I ran everything under docker-compose using three containers(bokeh server, flask-gunicorn, nginx proxy). I used the “–use-xheaders” and “–prefix /bokeh” options appended to my “bokeh serve …” command. I’ve attached my nginx config file and also an example of how I call the bokeh server from within flask. The bokeh app gets integrated in a web page just as suggested in the bokeh documentation using {{script | safe}}.

Best,

-Joe

On Mon, Jan 7, 2019 at 2:39 AM Bryan Van de ven [email protected] wrote:

Hi,

Definitely more of an Nginx question. FWIW I’d possibly suggest you put the apps under some sort of prefix, e.g. /apps/app1, etc. Then I think you could avoid using try_files, since routes to /apps/ would be unambiguously different from / (but I am not an expert here).

Thanks,

Bryan

On Jan 3, 2019, at 13:49, [email protected] wrote:

Bryan, I forgot about those options. Adding --disable-index --disable-index-redirect works nicely for the Bokeh server, not allowing localhost:5100 to show the list of apps.

However, I want users to go to the “/” and see an index.html file that Nginx serves up first (and not a Page 404). This is more of a Nginx question I guess.

On Thursday, January 3, 2019 at 9:28:50 PM UTC, Bryan Van de ven wrote:

Hi,

You can start the Bokeh server with the --disable-index and --disable-index-redirect options if you want to make sure Bokeh server does not respond to “/”.

Thanks,

Bryan

On Jan 3, 2019, at 13:25, [email protected] wrote:

Bryan, there is an index file that Nginx serves up if the Bokeh server is not running.

Once again, I made it work! The culprit seems to be the line:

try_files $uri $uri/ =404;

Commenting it out makes the Nginx proxy server work nicely, pointing to the Bokeh server. Meaning I can type in http://localhost and I can see my app running at localhost/myapp.

However there is slight issue with the case of running multiple apps. localhost now brings me to the Bokeh server landing page with the list of apps. How do I tweak the Nginx config file to show the index.html file instead? I am assuming the line I just commented out was meant to do that, going by the comments above it.

On Thursday, January 3, 2019 at 9:02:02 PM UTC, Bryan Van de ven wrote:

Hi,

You have both:

    location / { ... }

and:

    index index.html index.htm index.nginx-debian.html;

I’m not an nginx expert but these options seem incompatible? If the “index” statement takes precedence, and there is no index.html to return, that could explain the 404

Thanks,

Bryan

On Jan 3, 2019, at 12:49, [email protected] wrote:

Sarah, Thanks for your suggestion.

I tried that but ran into issues starting the bokeh server on port 80 even with sudo.

I might be wrong, but I thought the whole idea of using a proxy server like Nginx is to hide which port the bokeh server is running on when the outside users connect to port 80.

On Tuesday, January 1, 2019 at 3:48:01 PM UTC, Sarah Bird wrote:

Have you tried starting bokeh on port 80? (you might need sudo to do that)

Or, what have you done to setup nginx to do the redirect? This isn’t something I know a lot about but I found this stack overflow post.

https://stackoverflow.com/questions/34744713/nginx-redirect-http-to-https-with-custom-port-server

On Thursday, December 27, 2018 at 11:26:31 PM UTC-6, Kaushik Mallick wrote:

First disclosure: I am not very knowledgeable in setting up reverse proxy etc.

I am trying to bokeh serve multiple apps, lets say: appA, appB, appC. I have all my apps in separate folders. I have deployed all the apps by issuing:

bokeh serve appA appB appC --port 5100

When I go to http://localhost:5100, I see all my apps listed. Clicking each of them fire up the app in its own subfolder. For example I can see my appA working in localhost:5100/appA. So far so good.

Now I want to set up nginx as reverse proxy to the bokeh server. I am following the instructions in https://bokeh.pydata.org/en/latest/docs/user_guide/server.html

I have modified the /etc/nginx/sites-enabled/default file (attached) as instructed. After starting the nginx service I can go to http://localhost (port 80) and see all the apps listed there (great!). However when I click on each link for the apps, I get a 404 page error. The apps still function in localhost:5100/app*. I was of the idea that the purpose of the nginx reverse proxy was to allow the apps be reachable directly from port 80.

What could I be doing wrong? I sense its something simple in my setup. Thanks a lot in advance for any suggestion or advice.

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/46b8c0a9-23d3-41ff-b40d-e9ff61c8e32f%40continuum.io.

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

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/a32254da-ac8a-46da-94fc-f2905f0480be%40continuum.io.

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

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/e987bc3d-70f4-4c5d-8ca9-ae947544a45d%40continuum.io.

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

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/E7315D53-5C63-44A4-BF1B-E3EFBD31430B%40anaconda.com.

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

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/679cb420-c9f4-428f-b7a6-4712f0bf1b16%40continuum.io.

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

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/60ba2ab9-3440-4b78-89ea-6bd7edf7cd05%40continuum.io.

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

Hi,

Just for more context, the --use-xheaders option causes Bokeh to override the remote IP and URI scheme/protocol for all requests with X-Real-Ip, X-Forwarded-For, X-Scheme, X-Forwarded-Proto headers when they are available. AFAIK this would typically be necessary when your proxy is terminating SSL, but more generally I suppose they would be needed any time you have something along the lines of

  proxy_set_header X-Forwarded-Proto $scheme;
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

in your proxy conf.

Thanks,

Bryan

···

On Jan 10, 2019, at 05:17, Joseph St.Amand <[email protected]> wrote:

One difference I noticed is that I use the "--use-xheaders" option when starting my bokeh server.

I have those environment variables set to:
BOKEH_SERVER_HOSTNAME = bokeh // this is the name of the docker container running my bokeh server, it gets resolved to an IP in the docker network (it's 172.18.0.something)
HOST_IP = 10.240.0.10 // this is the local network IP of the machine hosting the docker apps.

Best,
-Joe

On Wed, Jan 9, 2019 at 7:27 PM <[email protected]> wrote:
Joe
Appreciate your help! I am not using docker but I do have a virtualenv that I am launching my Flask based website from. I adapted my Flask app route from what you have provided, but its much more straightforward to carry out my initial testing within the local network:

@app.route('/test')

def test():

    bokeh_app = 'bokeh/myapp'
    app_url = 'http://%s:%s/%s' % ('127.0.0.1', '5100', bokeh_app)

    session = pull_session(url=app_url)
    script = server_session(None, session.id, url=app_url)
    return render_template("test.html", script=script, template="Flask")

My Nginx is setup similar to yours. When I call my bokeh app with "--prefix /bokeh" option, the page link to /test (localhost/test) shows all the headers and content except the embedded bokeh app. This is what I use for starting my Bokeh server:

bokeh serve myapp --port 5100 --allow-websocket-origin='*'

However, starting the bokeh server without the "--prefix /bokeh" option and changing the variable

bokeh_app = 'myapp'

in Flask shows the embedded Bokeh app fine. I am struggling to find what is different in my setup from yours, since I would like all my Bokeh apps to appear under the /bokeh.

Also do you mind advising on what to set for the environmental variables like 'BOKEH_SERVER_HOSTNAME' and 'HOST_IP' just so that I am clear? Thanks again.

On Wednesday, January 9, 2019 at 1:39:11 PM UTC, Joseph St.Amand wrote:

    Yes it definitely works great for what I am doing here -- on my website I have four separate bokeh apps embedding in various webpages, it's been running good for about a month now with no issues. All using the same techniques in the flask app file I had sent.

    Since you aren't using docker, you will have to change the app.py file for your own setup and fill in all the environment variables, rename app route and bokeh_app, etc ...

    I'd check in your flask app that the host_url and app_url variables are what you expect. Also keep an eye on the bokeh logs to check that the request is reaching your bokeh server and that it is responding.

    Best,
    -Joe

    On Wed, Jan 9, 2019 at 3:28 AM <[email protected]> wrote:

        Joseph, Thanks for your guidance and for attaching the config files. I used your Nginx config file and it works nicely for proxy setup. However not so much luck with the bokeh app embedded inside the Flask.

        Can you please confirm that the /MyApp link (as defined in your Flask configuration) actually resolves and shows the embedded Bokeh app? I just can't get it to work.

        And I am using the latest, Bokeh 1.0.3.

        On Monday, January 7, 2019 at 4:27:40 AM UTC-7, Joseph St.Amand wrote:

            That's what I would suggest as well.

            I had some trouble getting everything working with nginx as a reverse proxy as well, I'm glad to share what I can about what I cludged together (Disclaimer: I'm not a web developer).

            I ran everything under docker-compose using three containers(bokeh server, flask-gunicorn, nginx proxy). I used the "--use-xheaders" and "--prefix /bokeh" options appended to my "bokeh serve ...." command. I've attached my nginx config file and also an example of how I call the bokeh server from within flask. The bokeh app gets integrated in a web page just as suggested in the bokeh documentation using {{script | safe}}.

            Best,

            -Joe

            On Mon, Jan 7, 2019 at 2:39 AM Bryan Van de ven <[email protected]> wrote:

                Hi,

                Definitely more of an Nginx question. FWIW I'd possibly suggest you put the apps under some sort of prefix, e.g. /apps/app1, etc. Then I think you could avoid using try_files, since routes to /apps/ would be unambiguously different from / (but I am not an expert here).

                Thanks,

                Bryan

                > On Jan 3, 2019, at 13:49, [email protected] wrote:
                >
                > Bryan, I forgot about those options. Adding --disable-index --disable-index-redirect works nicely for the Bokeh server, not allowing localhost:5100 to show the list of apps.
                > However, I want users to go to the "/" and see an index.html file that Nginx serves up first (and not a Page 404). This is more of a Nginx question I guess.
                >
                > On Thursday, January 3, 2019 at 9:28:50 PM UTC, Bryan Van de ven wrote:
                > Hi,
                >
                > You can start the Bokeh server with the --disable-index and --disable-index-redirect options if you want to make sure Bokeh server does not respond to "/".
                >
                > Thanks,
                >
                > Bryan
                >
                > > On Jan 3, 2019, at 13:25, [email protected] wrote:
                > >
                > > Bryan, there is an index file that Nginx serves up if the Bokeh server is not running.
                > >
                > > Once again, I made it work! The culprit seems to be the line:
                > >
                > > try_files $uri $uri/ =404;
                > >
                > > Commenting it out makes the Nginx proxy server work nicely, pointing to the Bokeh server. Meaning I can type in http://localhost and I can see my app running at localhost/myapp.
                > >
                > > However there is slight issue with the case of running multiple apps. localhost now brings me to the Bokeh server landing page with the list of apps. How do I tweak the Nginx config file to show the index.html file instead? I am assuming the line I just commented out was meant to do that, going by the comments above it.
                > >
                > > On Thursday, January 3, 2019 at 9:02:02 PM UTC, Bryan Van de ven wrote:
                > > Hi,
                > >
                > > You have both:
                > >
                > > location / { ... }
                > >
                > > and:
                > >
                > > index index.html index.htm index.nginx-debian.html;
                > >
                > > I'm not an nginx expert but these options seem incompatible? If the "index" statement takes precedence, and there is no index.html to return, that could explain the 404
                > >
                > > Thanks,
                > >
                > > Bryan
                > >
                > > > On Jan 3, 2019, at 12:49, [email protected] wrote:
                > > >
                > > > Sarah, Thanks for your suggestion.
                > > > I tried that but ran into issues starting the bokeh server on port 80 even with sudo.
                > > >
                > > > I might be wrong, but I thought the whole idea of using a proxy server like Nginx is to hide which port the bokeh server is running on when the outside users connect to port 80.
                > > >
                > > >
                > > > On Tuesday, January 1, 2019 at 3:48:01 PM UTC, Sarah Bird wrote:
                > > > Have you tried starting bokeh on port 80? (you might need sudo to do that)
                > > >
                > > > Or, what have you done to setup nginx to do the redirect? This isn't something I know a lot about but I found this stack overflow post.
                > > > https://stackoverflow.com/questions/34744713/nginx-redirect-http-to-https-with-custom-port-server
                > > >
                > > >
                > > > On Thursday, December 27, 2018 at 11:26:31 PM UTC-6, Kaushik Mallick wrote:
                > > > First disclosure: I am not very knowledgeable in setting up reverse proxy etc.
                > > >
                > > > I am trying to bokeh serve multiple apps, lets say: appA, appB, appC. I have all my apps in separate folders. I have deployed all the apps by issuing:
                > > >
                > > > bokeh serve appA appB appC --port 5100
                > > >
                > > > When I go to http://localhost:5100, I see all my apps listed. Clicking each of them fire up the app in its own subfolder. For example I can see my appA working in localhost:5100/appA. So far so good.
                > > >
                > > > Now I want to set up nginx as reverse proxy to the bokeh server. I am following the instructions in https://bokeh.pydata.org/en/latest/docs/user_guide/server.html
                > > >
                > > > I have modified the /etc/nginx/sites-enabled/default file (attached) as instructed. After starting the nginx service I can go to http://localhost (port 80) and see all the apps listed there (great!). However when I click on each link for the apps, I get a 404 page error. The apps still function in localhost:5100/app*. I was of the idea that the purpose of the nginx reverse proxy was to allow the apps be reachable directly from port 80.
                > > >
                > > > What could I be doing wrong? I sense its something simple in my setup. Thanks a lot in advance for any suggestion or advice.
                > > >
                > > > --
                > > > 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/46b8c0a9-23d3-41ff-b40d-e9ff61c8e32f%40continuum.io.
                > > > For more options, visit https://groups.google.com/a/continuum.io/d/optout.
                > >
                > >
                > > --
                > > 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/a32254da-ac8a-46da-94fc-f2905f0480be%40continuum.io.
                > > For more options, visit https://groups.google.com/a/continuum.io/d/optout.
                >
                >
                > --
                > 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/e987bc3d-70f4-4c5d-8ca9-ae947544a45d%40continuum.io.
                > For more options, visit https://groups.google.com/a/continuum.io/d/optout.

                --
                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/E7315D53-5C63-44A4-BF1B-E3EFBD31430B%40anaconda.com.
                For more options, visit https://groups.google.com/a/continuum.io/d/optout.

        --
        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/679cb420-c9f4-428f-b7a6-4712f0bf1b16%40continuum.io.
        For more options, visit https://groups.google.com/a/continuum.io/d/optout.

On Wednesday, January 9, 2019 at 6:39:11 AM UTC-7, Joseph St.Amand wrote:
Yes it definitely works great for what I am doing here -- on my website I have four separate bokeh apps embedding in various webpages, it's been running good for about a month now with no issues. All using the same techniques in the flask app file I had sent.

Since you aren't using docker, you will have to change the app.py file for your own setup and fill in all the environment variables, rename app route and bokeh_app, etc ...

I'd check in your flask app that the host_url and app_url variables are what you expect. Also keep an eye on the bokeh logs to check that the request is reaching your bokeh server and that it is responding.

Best,
-Joe

On Wed, Jan 9, 2019 at 3:28 AM <[email protected]> wrote:
Joseph, Thanks for your guidance and for attaching the config files. I used your Nginx config file and it works nicely for proxy setup. However not so much luck with the bokeh app embedded inside the Flask.

Can you please confirm that the /MyApp link (as defined in your Flask configuration) actually resolves and shows the embedded Bokeh app? I just can't get it to work.

And I am using the latest, Bokeh 1.0.3.

On Monday, January 7, 2019 at 4:27:40 AM UTC-7, Joseph St.Amand wrote:
That's what I would suggest as well.

I had some trouble getting everything working with nginx as a reverse proxy as well, I'm glad to share what I can about what I cludged together (Disclaimer: I'm not a web developer).

I ran everything under docker-compose using three containers(bokeh server, flask-gunicorn, nginx proxy). I used the "--use-xheaders" and "--prefix /bokeh" options appended to my "bokeh serve ...." command. I've attached my nginx config file and also an example of how I call the bokeh server from within flask. The bokeh app gets integrated in a web page just as suggested in the bokeh documentation using {{script | safe}}.

Best,

-Joe

On Mon, Jan 7, 2019 at 2:39 AM Bryan Van de ven <[email protected]> wrote:
Hi,

Definitely more of an Nginx question. FWIW I'd possibly suggest you put the apps under some sort of prefix, e.g. /apps/app1, etc. Then I think you could avoid using try_files, since routes to /apps/ would be unambiguously different from / (but I am not an expert here).

Thanks,

Bryan

> On Jan 3, 2019, at 13:49, [email protected] wrote:
>
> Bryan, I forgot about those options. Adding --disable-index --disable-index-redirect works nicely for the Bokeh server, not allowing localhost:5100 to show the list of apps.
> However, I want users to go to the "/" and see an index.html file that Nginx serves up first (and not a Page 404). This is more of a Nginx question I guess.
>
> On Thursday, January 3, 2019 at 9:28:50 PM UTC, Bryan Van de ven wrote:
> Hi,
>
> You can start the Bokeh server with the --disable-index and --disable-index-redirect options if you want to make sure Bokeh server does not respond to "/".
>
> Thanks,
>
> Bryan
>
> > On Jan 3, 2019, at 13:25, [email protected] wrote:
> >
> > Bryan, there is an index file that Nginx serves up if the Bokeh server is not running.
> >
> > Once again, I made it work! The culprit seems to be the line:
> >
> > try_files $uri $uri/ =404;
> >
> > Commenting it out makes the Nginx proxy server work nicely, pointing to the Bokeh server. Meaning I can type in http://localhost and I can see my app running at localhost/myapp.
> >
> > However there is slight issue with the case of running multiple apps. localhost now brings me to the Bokeh server landing page with the list of apps. How do I tweak the Nginx config file to show the index.html file instead? I am assuming the line I just commented out was meant to do that, going by the comments above it.
> >
> > On Thursday, January 3, 2019 at 9:02:02 PM UTC, Bryan Van de ven wrote:
> > Hi,
> >
> > You have both:
> >
> > location / { ... }
> >
> > and:
> >
> > index index.html index.htm index.nginx-debian.html;
> >
> > I'm not an nginx expert but these options seem incompatible? If the "index" statement takes precedence, and there is no index.html to return, that could explain the 404
> >
> > Thanks,
> >
> > Bryan
> >
> > > On Jan 3, 2019, at 12:49, [email protected] wrote:
> > >
> > > Sarah, Thanks for your suggestion.
> > > I tried that but ran into issues starting the bokeh server on port 80 even with sudo.
> > >
> > > I might be wrong, but I thought the whole idea of using a proxy server like Nginx is to hide which port the bokeh server is running on when the outside users connect to port 80.
> > >
> > >
> > > On Tuesday, January 1, 2019 at 3:48:01 PM UTC, Sarah Bird wrote:
> > > Have you tried starting bokeh on port 80? (you might need sudo to do that)
> > >
> > > Or, what have you done to setup nginx to do the redirect? This isn't something I know a lot about but I found this stack overflow post.
> > > https://stackoverflow.com/questions/34744713/nginx-redirect-http-to-https-with-custom-port-server
> > >
> > >
> > > On Thursday, December 27, 2018 at 11:26:31 PM UTC-6, Kaushik Mallick wrote:
> > > First disclosure: I am not very knowledgeable in setting up reverse proxy etc.
> > >
> > > I am trying to bokeh serve multiple apps, lets say: appA, appB, appC. I have all my apps in separate folders. I have deployed all the apps by issuing:
> > >
> > > bokeh serve appA appB appC --port 5100
> > >
> > > When I go to http://localhost:5100, I see all my apps listed. Clicking each of them fire up the app in its own subfolder. For example I can see my appA working in localhost:5100/appA. So far so good.
> > >
> > > Now I want to set up nginx as reverse proxy to the bokeh server. I am following the instructions in https://bokeh.pydata.org/en/latest/docs/user_guide/server.html
> > >
> > > I have modified the /etc/nginx/sites-enabled/default file (attached) as instructed. After starting the nginx service I can go to http://localhost (port 80) and see all the apps listed there (great!). However when I click on each link for the apps, I get a 404 page error. The apps still function in localhost:5100/app*. I was of the idea that the purpose of the nginx reverse proxy was to allow the apps be reachable directly from port 80.
> > >
> > > What could I be doing wrong? I sense its something simple in my setup. Thanks a lot in advance for any suggestion or advice.
> > >
> > > --
> > > 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/46b8c0a9-23d3-41ff-b40d-e9ff61c8e32f%40continuum.io.
> > > For more options, visit https://groups.google.com/a/continuum.io/d/optout.
> >
> >
> > --
> > 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/a32254da-ac8a-46da-94fc-f2905f0480be%40continuum.io.
> > For more options, visit https://groups.google.com/a/continuum.io/d/optout.
>
>
> --
> 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/e987bc3d-70f4-4c5d-8ca9-ae947544a45d%40continuum.io.
> For more options, visit https://groups.google.com/a/continuum.io/d/optout.

--
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].io.
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/E7315D53-5C63-44A4-BF1B-E3EFBD31430B%40anaconda.com.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

--
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/679cb420-c9f4-428f-b7a6-4712f0bf1b16%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

--
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/60ba2ab9-3440-4b78-89ea-6bd7edf7cd05%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

--
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/CAGkeYKbg-K4prXvp27L7VAar5JOpFTo-1Z70rCSPbcQ-jTtLjw%40mail.gmail.com.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.