如何处理net :: ERR_SSL_PROTOCOL_ERROR? [英] How to deal with net::ERR_SSL_PROTOCOL_ERROR?
问题描述
我将JS库包含到我的网站中
I am including a JS library into my website
<script type="text/javascript" src="http://www.turnjs.com/lib/turn.min.js "></script>
由网页设计公司设计,维护和托管的
. 我要实现的目标的实现似乎编码正确-请参阅我的 JSFiddle –工作正常,没有错误.但是,当将代码从我的JSfiddle复制并粘贴到我的网站时,它根本无法工作-Google Chrome开发者控制台显示以下内容:
that is designed, maintained and hosted by a webdesign company. The implementation of what I am trying to achieve seems to be well coded – see my JSFiddle – it works fine with no errors. However when a copy and paste the code from my JSfiddle into my website, it doesn’t work at all – Google Chrome developer console shows this:
GET https://www.turnjs.com/lib/turn.min.js net::ERR_SSL_PROTOCOL_ERROR
但这很奇怪,因为我的Jsfiddle代码包含相同的turn.min.js
并且可以在其中运行,但是在我的网站上却没有.
But it is weird, since my Jsfiddle code is including the same turn.min.js
and it works there, but on my website it doesn’t.
推荐答案
这不是JavaScript问题,而是ssl探针.
This is not a javascript problem, it's an ssl probem.
您不能通过通过安全连接(https)提供服务的html页面通过不安全连接(http)获取文件.如果要使用https(应该!),则需要通过安全连接获取脚本. 要获取文件,您应该使用:
You can't get a file through an insecure connection (http) from a html page served through a secure connection (https). If you're going to use https (and you SHOULD!) then you need to get the script through a secure connection. To get the file, you should use:
<script type="text/javascript" src="https://www.turnjs.com/lib/turn.min.js "></script>
并通过相应地配置服务器,确保通过https提供文件.这是 lighttpd 的简单配置,这是
And make sure that the file is being served through https, by configuring the server accordingly. Here's a simple configuration for lighttpd, and here's one for apache. If you don't have a CA signed certificate, you could get one with letsencrypt ( www.letsencrypt.org/getting-started/ ). If you don't control the server, you should get in contact with the person who does.
这篇关于如何处理net :: ERR_SSL_PROTOCOL_ERROR?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!