添加Content Security Policy
请求头
方式一:使用nginx配置
代码语言:javascript复制在location下添加:add_header Content-Security-Policy "upgrade-insecure-requests;connect-src *";
百度得到的很多都让加在server下,这种是不生效的,百度第一页的方法我是都尝试过了,血与泪的教训,坑啊,都是让在server下添加
参考资料:https://f2ex.cn/configure-content-security-policy/ 方式二:前端h5中添加
代码语言:javascript复制<meta http-equiv="Content-Security-Policy" content="style-src 'self' 'unsafe-inline';script-src 'self' 'unsafe-inline' 'unsafe-eval' https://webapi.amap.com https://restapi.amap.com https://vdata.amap.com https://appx/web-view.min.js;worker-src blob:">