我正在尝试在我的开发环境中通过 Chrome 连接到 API。
我已将本地主机配置为在 SSL 下运行以进行测试,
当我使用 https://
连接到 API 时出现此错误
request.js:132 OPTIONS https://api.thenounproject.com:80/icons/test net::ERR_SSL_PROTOCOL_ERROR
为了让本地开发在 Chrome 中运行在 https 上,我必须启用:
chrome://flags/#allow-insecure-localhost.
开发环境中是否存在这些讨厌的安全问题?
最佳答案
老问题,可能你已经有了答案,但我还是会发布它,因为如果你寻找 ERR_SSL_PROTOCOL_ERROR
和 localhost
,它是谷歌上的热门话题(有 732 次观看)。
我在使用 NGINX
时遇到了这个错误,并在 google chrome 中得到了 ERR_SSL_PROTOCOL_ERROR
。谷歌搜索该错误消息并没有给我一个快速的答案。然而,Firefox 抛出 SSL_ERROR_RX_RECORD_TOO_LONG
。谷歌搜索该错误消息使我找到了 this answer服务器故障及其接受的答案对我有用。
我所要做的就是将 ssl
添加到服务器 block 中的监听行:
listen 443 ssl;
NGINX
documentation也提到了这一点。
To configure an HTTPS server, the ssl parameter must be enabled on listening sockets in the server block, and the locations of the server certificate and private key files should be specified:
关于google-chrome - Localhost SSL 连接到 api ERR_SSL_PROTOCOL_ERROR,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48571876/