Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/security/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Security 如何将本地站点添加到内容安全策略的框架中?_Security_Iis - Fatal编程技术网

Security 如何将本地站点添加到内容安全策略的框架中?

Security 如何将本地站点添加到内容安全策略的框架中?,security,iis,Security,Iis,我们最近在我们的网站上实施了一项内容安全策略,以限制哪些网站可以使用iframe。我们在IIS上托管,web.config中的行如下所示 这是因为只有指定的测试环境才能在站点中创建iframe 我们当前的问题是,我们的客户无法在其本地开发环境中访问该网站,因为它被上述策略阻止。他们的本地站点是在IIS中设置的,主机文件中有一个条目与CSP中允许的域之一相匹配,dev.website.com 我们尝试添加以下内容 本地主机:* 127.0.0.1:* dev.website.com 不幸的是

我们最近在我们的网站上实施了一项内容安全策略,以限制哪些网站可以使用iframe。我们在IIS上托管,web.config中的行如下所示

这是因为只有指定的测试环境才能在站点中创建iframe

我们当前的问题是,我们的客户无法在其本地开发环境中访问该网站,因为它被上述策略阻止。他们的本地站点是在IIS中设置的,主机文件中有一个条目与CSP中允许的域之一相匹配,
dev.website.com

我们尝试添加以下内容

  • 本地主机:*
  • 127.0.0.1:*
  • dev.website.com

不幸的是,没有一个成功。任何帮助都将不胜感激,谢谢。

我也有同样的问题;对我来说,只有在
localhost
上指定了端口(我在Express中工作),它才起作用:

app.use(helmet.contentSecurityPolicy)({
指令:{
框架祖先:[”https://some-domain.app", "http://localhost:3000"]
}
}))

这允许我在
localhost
上加载带有iframe的站点,用于本地开发。

这将是一个延迟回复,但我也试图在web.config中解决这个问题,在尝试了一些其他模式后,这个模式对我有效:

<add name="Content-Security-Policy" value="frame-ancestors 'self' *.example.com *.example.net http://localhost:8005" />