【问题标题】:How to enable SSL/HTTPS on bokeh 0.12.5?如何在散景 0.12.5 上启用 SSL/HTTPS?
【发布时间】:2017-05-17 09:56:16
【问题描述】:
我创建了一个简单的 Bokeh 应用程序,它通过 bokeh serve 成功运行。然后我被问到是否可以使用 HTTPS 重新部署它。客户端已经拥有 SSL 证书,并且该应用程序只能在其内部网中访问。大多数搜索结果都是针对 Apache 或 Nginx 等代理服务器后面的部署。我们需要这些来设置 SSL 吗?可以在 Bokeh 上原生完成吗?
【问题讨论】:
标签:
python
ssl
https
bokeh
【解决方案1】:
Bokeh Server 没有内置任何 SSL 功能。如果需要,您需要部署在可以终止 SSL 连接的代理(例如 Nginx)后面。用户指南部分Reverse Proxying with Nginx and SSL 中有所需设置的说明。要点是您需要使用 --use-xheaders 选项启动 Bokeh 服务器本身,然后具有类似于以下内容的 Nginx 配置:
location / {
proxy_pass http://127.0.0.1:5100;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_http_version 1.1;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host:$server_port;
proxy_buffering off;
}
可能其他代理也可以工作,只要它们也可以代理 websockets。