Request for nginx config for Flask + Bokeh server

@Gopi_M

There are a lot of variables at play when trying to use https with nginx + flask + bokeh, including the environment where deployed, how nginx is configured (e.g. terminating SSL connections), and how bokeh is embedded.

Without any insight into the details of your setup, a few thoughts of things to try based on an inspection of the excerpts in this thread.

In the most recent post, it looks like the complaint is related to mixed http/https protocols, and the Flask app at :5003 is being run under http. What happens if you add an SSL context argument to the app( ) instantiation call? Something like the following

#run the app
if __name__ == "__main__":
    app.run(host='0.0.0.0', port=5003, ssl_context=('cert.pem','key.pem'))

where the cert.pem and key.pem are the certificate and key files.

Also, if you’re using self-signed certificates, note the following.

I originally had problems running a bokeh server securely using Gunicorn+Flask and an HTTPS address. In my case, the issue came down to needing to generate a Subject Alternative Name (SAN) certificate when I made a self-signed certificate via openssl for testing.

If you’re using a self-signed certificate, that might be what you’re running into as well. See this topic on bokeh discourse towards the end of the discussion for a link to more info.

https://discourse.bokeh.org/t/help-needed-with-ssl-for-a-nginx-gunicorn-flask-bokeh-setup/6069/8

Lastly, if those suggestions do not resolve the issue you might try setting the log level to debug for JavaScript Bokeh JS code, via BOKEH_LOG_LEVEL environment variable described here …

https://docs.bokeh.org/en/latest/docs/reference/settings.html

to see if that gives any further insight into things