nxez / pi-dashboard

A WebUI dashboard for IoT devices likes raspberry pi.
GNU General Public License v3.0
814 stars 202 forks source link

不明原因的CSP未定义问题 #21

Open 46EULER opened 4 years ago

46EULER commented 4 years ago

复杂网络环境下(nginx+V2RAY桥接到树莓派localhost,页面使用nginx反代),默认配置会出现不明原因的浏览器忽略CSP默认参数问题。 需要在nginx的server{}中配置添加CSP头: `server { add_header Content-Security-Policy "default-src 'self' https://*.googleapis.com/ 'unsafe-eval' 'unsafe-inline';script-src 'self' https://*.googleapis.com/ 'unsafe-eval' 'unsafe-inline';img-src 'self';font-src 'self' https://fonts.gstatic.com/;";

other locations

location / {

此部分需要根据实际情况自行修改

}

} `