Javascript 内容安全策略和Express.js存在问题

Javascript 内容安全策略和Express.js存在问题,javascript,express,content-security-policy,phaser,Javascript,Express,Content Security Policy,Phaser,我在学习速成教程时遇到了一些问题。我不断收到内容安全策略警告,尽管我在响应标题中添加了一些内容。以下是我的服务器代码以了解更多上下文: const{MongoClient,ObjectID}=require(“mongodb”); const Express=require(“Express”)(); const Cors=要求(“Cors”); const BodyParser=require(“body parser”); const{request}=require(“express”);

我在学习速成教程时遇到了一些问题。我不断收到内容安全策略警告,尽管我在响应标题中添加了一些内容。以下是我的服务器代码以了解更多上下文:

const{MongoClient,ObjectID}=require(“mongodb”);
const Express=require(“Express”)();
const Cors=要求(“Cors”);
const BodyParser=require(“body parser”);
const{request}=require(“express”);
常数csp=要求(“头盔csp”);
const client=newmongoclient(process.env[“ATLAS_URI”]);
use(BodyParser.json());
use(BodyParser.urlencoded({extended:true}));
Express.use(Cors());
快用(
顾客服务提供商({
指令:{
defaultSrc:[`safe-inline`、`self`],
scriptSrc:[`self`、`safe-inline`、`safe-eval`、`http://*`],
styleSrc:[`self`、`safe-inline`、`http://*`],
fontSrc:[`self'`],
frameSrc:[`self'`],
connectSrc:[`self'`],
imgSrc:[`self'`],
objectSrc:[`self'`],
reportUri:`/csp`
},
仅报告:对,
}),
);
var集合;
Express.listen(“3000”,异步()=>{
试一试{
等待client.connect();
collection=client.db(“gamedev”).collection(“分数”);
createIndex({“location”:“2dsphere”});
}捕获(e){
控制台错误(e);
}
});
Express.post(“/create”),异步(请求、响应)=>{
//创建代码
});
Express.get(“/get”),异步(请求、响应)=>{
//获取代码
});
Express.get(“/getNearLocation”),异步(请求、响应)=>{
//getNearLocation代码
});
基本上,每当我运行此代码,并尝试使用我拥有的客户端程序访问它时,我都会遇到以下错误,即使我似乎已在代码中使用
helmet csp

Content Security Policy: The page’s settings blocked the loading of a resource at http://localhost:3000/favicon.ico (“default-src”).
此外,当我卷曲
http://localhost:3000
,我得到了200 OK的响应,但当我卷曲
http://localhost:3000/get
或任何预定义的快速路线,我都会遇到404错误

$ curl -I http://localhost:3000/
HTTP/1.1 200 OK
X-Powered-By: Express
Accept-Ranges: bytes
Content-Type: text/html; charset=UTF-8
Content-Length: 150
ETag: W/"96-tX0B7LKaOuUPvTVjHjbS+EAVlus"
Date: Tue, 29 Sep 2020 00:27:53 GMT
Connection: keep-alive

在此方面的任何帮助或配对都将不胜感激!:(我的大脑在慢慢煎熬

你能给我看一下
$curl-I的response标题吗http://localhost:3000/favicon.ico
?看起来您一次就有了publich 2 CSP。错误
页面的设置阻止了此时加载资源http://localhost:3000/favicon.ico (“默认src”)
它在Firefox中,你能看看Chrome吗?它更详细。
$ curl -I http://localhost:3000/
HTTP/1.1 200 OK
X-Powered-By: Express
Accept-Ranges: bytes
Content-Type: text/html; charset=UTF-8
Content-Length: 150
ETag: W/"96-tX0B7LKaOuUPvTVjHjbS+EAVlus"
Date: Tue, 29 Sep 2020 00:27:53 GMT
Connection: keep-alive
$ curl -I http://localhost:3000/get
HTTP/1.1 404 Not Found
X-Powered-By: Express
Content-Security-Policy: default-src 'none'
X-Content-Type-Options: nosniff
Content-Type: text/html; charset=utf-8
Content-Length: 143
Date: Tue, 29 Sep 2020 00:31:44 GMT
Connection: keep-alive