STrapi页面在本地主机上可以正常工作,但当我在replit上托管它时,它会出现这些错误
main.9c01de7f.js:2981 Refused to connect to 'http://localhost:1337/admin/project-type' because it violates the following Content Security Policy directive: "connect-src 'self' https:".
(anonymous) @ main.9c01de7f.js:2981
main.9c01de7f.js:171 oe
(anonymous) @ main.9c01de7f.js:171
main.9c01de7f.js:3929 Refused to connect to 'http://localhost:1337/admin/init' because it violates the following Content Security Policy directive: "connect-src 'self' https:".
The code can be seem here https://replit.com/@MAAZ-GAMERGAMER/SelfreliantEdibleDatalog?v=1
1条答案
按热度按时间dy2hfwbg1#
Strapi在后端强制CSP。
在您的
simple strapi one client
中,在src/utils/api.js中添加以下标题Content-Security-Policy: connect-src 'self' http://localhost:1337/