【发布时间】:2021-05-28 17:30:17
【问题描述】:
我有一个 apache 2.4,就像反向代理一样。在将用户代理到目标服务器之前,我使用简单的表单登录对用户进行身份验证。
登录页面很简单:
<!doctype html>
<html lang="it">
<head><title>AUTENTICAZIONE</title>
</head>
<body>
<script type="text/javascript">
</script>
<form method="POST" action="/dologin2.html">
Username: <input type="text" name="httpd_username" value="" />
Password: <input type="password" name="httpd_password" value="" />
<input type="submit" name="login" value="Login" />
<input type="hidden" name="httpd_location" value="https://sgsvrsiimws11lx.sistemi.group/primoacc/sigma/app" />
</form>
</body>
</html>
我在这个页面上遇到了 Firefox 和 chrome 的问题:
拒绝执行内联脚本,因为它违反了以下内容 内容安全策略指令:“default-src 'self'”。无论是 'unsafe-inline' 关键字,一个哈希 ('sha256-AbpHGcgLb+kRsJGnwFEktk7uzpZOCcBY74+YBdrKVGs='),或随机数 ('nonce-...') 是启用内联执行所必需的。另请注意 'script-src' 没有明确设置,所以 'default-src' 被用作 后备。
在我的 httpd.conf 中我已经设置了这个:
标头集 Content-Security-Policy "frame-ancestors 'unsafe-inline' '自我' sgsvrsiimws11lx.sistemi.group;"
我已经设置了它,因为后端的一些角度对象没有加载。
我尝试了很多方式设置 Content-Security-Policy,但登录页面中的 javascript 总是出现错误。
即使我有那个错误我也可以用chrome登录,用firefox没有。
如何在 apache 中正确设置 Content-Security-Policy 标头以与我的登录页面正常工作?
谢谢
【问题讨论】:
标签: apache google-chrome firefox content-security-policy