我正在部署一个 React 应用程序,但是当我通过 https 访问该页面时出现一个奇怪的错误。
当我通过 https 访问页面时,我收到以下错误:
SecurityError:无法构建“WebSocket”:可能无法从通过 HTTPS 加载的页面启动不安全的 WebSocket 连接。
但是当我通过 http 访问该页面时,它运行良好。
问题是据我所知,我没有使用 websockets。我搜索了代码,看看是否有对 http 的请求应该是 https 或 ws: 而不是 wss: 但我什么也没看到。
有没有人遇到过这个?
我包含了 package.json 文件的副本。如果您需要我上传任何其他代码部分以帮助调试,请告诉我。
提前致谢。
{
"name": "client",
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.3.2",
"@testing-library/user-event": "^7.1.2",
"baffle": "^0.3.6",
"cross-env": "^6.0.3",
"react": "^16.12.0",
"react-dom": "^16.12.0",
"react-player": "^1.14.2",
"react-router-dom": "^5.1.2",
"react-scripts": "3.3.0",
"react-typist": "^2.0.5",
"webpack-hot-dev-clients": "^2.0.2"
},
"scripts": {
"start": "cross-env react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}