当我将新服务器添加到nestjs DocumentBuilder.addServer('http://localhost:7071')
时,当我尝试在生成的招摇页面上执行路由时,它会出现权限错误。
在浏览器控制台它会抛出这个错误:
Refused to connect to 'http://localhost:7071/api/session/signin' because it violates the following Content Security Policy directive: "default-src 'self'". Note that 'connect-src' was not explicitly set, so 'default-src' is used as a fallback.
Refused to connect to 'http://localhost:7071/api/session/signin' because it violates the document's Content Security Policy.
我已经在nestjs应用程序中启用了cors,但没有运气!
app.enableCors();
也许我在 DocumentBuilder 中遗漏了一些安全策略?像.addSecurity()
什么?如果是这种情况如何添加此安全策略?