如何解决“内容安全政策:该页面的设置阻止了http://localhost:8080/favicon.ico("default-src")上资源的加载." [英] How to fix 'Content Security Policy: The page’s settings blocked the loading of a resource at http://localhost:8080/favicon.ico (“default-src”).'
本文介绍了如何解决“内容安全政策:该页面的设置阻止了http://localhost:8080/favicon.ico("default-src")上资源的加载."的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我能够连接到服务器并使用get请求显示一些文本.但是,当我休息一会后重新启动服务器时,我被打了这个错误
I was able to connect to my server and use a get a request to display some text. However, when I restarted my server after taking a break, I was hit with this error
Content Security Policy: The page’s settings blocked the loading of a resource at http://localhost:8080/favicon.ico ("default-src").
如果有人可以向我指出正确的方向,那太好了.
If anyone can please point me in the right direction, that would be great.
如果有帮助,我正在使用最新版本的Firefox.
我更改了端口.我现在可以看到我的get请求,但是,我仍然收到错误消息
I changed the port. I can now see my get request, however, I'm still getting the error
const express = require ('express');
const cors = require('cors');
const app = express();
app.use(cors());
const port = 3001;
// was 8080
app.listen(port, () => {
console.log(`Server is up and listening on port ${port}`);
})
app.get('/', (req, res) => {
res.send({
express: 'Your express backend is connected to react'
})
})
推荐答案
也许与在https端口上运行http有关.尝试使用其他端口或将其转换为https.
maybe it has something to do with running http on https port. Try using another port or converting it to https.
这篇关于如何解决“内容安全政策:该页面的设置阻止了http://localhost:8080/favicon.ico("default-src")上资源的加载."的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文