Using IIS to serve Bokeh

Hi everyone! I am new to Internet Information Services for Windows. I have a dashboard ready and I can serve it using the terminal and the command

bokeh serve app_myapp/ --port 5200 --allow-websocket-origin=my_IP_address

In IIS, I have set up the Host Name (xx.yyy.com) and the port (80), and the physical address is C:\inetpub\wwwroot\some_blank_htm_file
Currently xx.yyy.com shows my blank file, but I don’t know how to connect serving my bokeh dashboard with IIS settings.
I would greatly appreciate any help.

Hi @Farinaz_Nazari I don’t have any experience with or access to IIS so I am not going to be much direct help, but some of the parts of the question were a bit confusing to me so I wanted to offer a few comments in general:

  • When using IIS (or nginx, or Apache) as a reverse proxy, the Bokeh server still has to be run as a separate process. (Just wanted to make sure that is clear)

  • The setup will likely be somewhat similar to the nginx/apache guidance in Basic Reverse Proxy Setup

  • If you do determine a configuration, it would be great to contribute to that docs section!

  • To embed the proxied app, you’ll still use the functions here, in a (non-empty) page:

    https://docs.bokeh.org/en/latest/docs/user_guide/embed.html#bokeh-applications

@Bryan Thank you for the tips. I had used Nginx with Bokeh before, but I didn’t know how to get the same functionality from IIS. I managed to solve the problem at last, and I’m going to write down the solution here in a different post, but how can I contribute to the docs section?

The goal is to use IIS as a reverse proxy. IIS is not a reverse proxy by default, so we have to add some modules and then start the configuration. These are all the steps I took:

  1. Install the URL Rewrite package from the Downloads section on the IIS website.
  2. Install the ARR (application request routing) module from the Downloads section on the IIS website.
  3. In IIS, under sites, add a new website and set the Host Name to your FQDN. Also, Choose a Site Name and a Physical Path (I think it doesn’t matter what.) and click OK.
  4. In the left pane, double-click on the website you created. In the modules, double-click on URL Rewrite, then click on Add Rule(s), choose Reverse Proxy and click OK. Then in the new window type 127.0.0.1:my_bokeh_port and hit OK.
  5. From the left pane, double-click on the main tree node with your server name on it, and from the modules, double-click on Application Request Routing Cache. In the right pane, choose Enable proxy, and set HTTP version to Pass through.
  6. Use this guide to set Server Farms. Honestly, I’m not really sure if this step is necessary, but since I had done it before some of the former steps I just mentioned, I thought it might be.
  7. Close and restart IIS.
  8. Now, if you go to your website in your browser, you will probably see your address (for example x.y.‘com’) change to x.y.‘com’/app_myapp. If you can also see your dashboard, then that’s all. If not, however, it means that your firewall is blocking the WebSocket connection. You can use this guide to allow a TCP connection to your Bokeh port.
  9. Hopefully, now you can refresh and see your dashboard.

Hi @Farinaz_Nazari that’s great to hear! We use the standard Sphinx documentation tool for Python projects. The ReST source code for the “Running a Bokeh Server” chapter is here:

So I would suggest a Pul Request to add the information above to a new subsection in the Basic Reverse Proxy Setup section of that document. I’m not sure your background, so I will just start with that suggestion and if you have questions are need more guidance on any aspect, please just let me know what I can elaborate on!

1 Like