尝试在烧瓶应用程序中提供安全脚本

Trying to serve secure script inside flask app

我正在尝试在我的 Flask 应用程序中提供以下脚本以实现数据可视化:

http://techanjs.org/techan.min.js

但是当我这样做时,我得到以下信息:

Mixed Content: The page at 'https://www.yaddayaddayadda.org/techan' was loaded over 
HTTPS, but requested an insecure script 'http://techanjs.org/techan.min.js'. This request 
has been blocked; the content must be served over HTTPS.   

但是当我像这样将其更改为 https 时

https://techanjs.org/techan.min.js

失败了。如果我将 url 加载到浏览器中,它就不起作用。有什么方法可以让它成功加载吗?

这与 Flask 无关。正确的是,您需要对包含的 JS 文件使用与 HTML 和 that should be HTTPS. The problem is that the TLS (a.k.a. SSL) certificate which the site is providing is valid for *.github.com 相同的方案。但是它从中加载 JS 的域是 techanjs.org,这肯定是不同的。因此证书对该站点无效,因此无法保护传输或证明所服务数据的真实性。

这是 techanjs.org 必须解决的问题。我鼓励你告诉他们这个问题。同时,您真的需要使用从其他站点链接的 .js 文件吗?如果您下载 .js 文件并在您自己的站点上提供它,问题就会消失。