今天在做文件上传的时候,出现了下面的错误:

Refused to apply inline style because it violates the following Content Security Policy directive: "default-src 'self'". Either the 'unsafe-inline' keyword, a hash ('sha256-4Su6mBWzEIFnH4pAGMOuaeBrstwJN4Z3pq/s1Kn4/KQ='), or a nonce ('nonce-...') is required to enable inline execution. Note also that 'style-src' was not explicitly set, so 'default-src' is used as a fallback.

伤透了脑筋,就是图片上传上去了,返回url的时候被拦截了,这是play里面的拦截引起的。

解决方法

在application.conf的headers里面加上这句:

 # The Content-Security-Policy header. If null, the header is not set.contentSecurityPolicy = "default-src 'self' 'unsafe-inline'"

参考文献

[1]. Refused to apply inline style because it violates the following Content Security Policy directive. https://stackoverflow.com/questions/17766817/refused-to-apply-inline-style-because-it-violates-the-following-content-security

playframework 2.6 refused to apply inline style because it violates the following Content Security相关推荐

  1. Refused to execute inline script because it violates the following Content Security Policy directive

    版权声明 本文原创作者:谷哥的小弟 作者博客地址:http://blog.csdn.net/lfdfhl 问题描述 在利用表单向后台提交数据时,前端页面报错: Refused to execute i ...

  2. Refused to load the image 'URL' because it violates the following content security polity diretive

    转载地址:https://www.cnblogs.com/xiaoxiaoluoye/p/6945044.html 深入学习地址:https://www.cnblogs.com/Hwangzhiyou ...

  3. uni-app - Refused to display ‘xxx‘ in a frame because an ancestor violates the following Content Sec

    报错原因 整体流程的话,就是将网页通过 web-view 组件内嵌到 App 中(非小程序),其中有跳转微信公众号的需求,不料却收到了以下报错. 我又不是打包小程序,就套壳个 App ,比较疑惑为什么 ...

  4. Refused to apply style from ‘http://localhost:8080/iconfont.css‘ because its MIME type (‘text/html‘

    Refused to apply style from 'http://localhost:8080/iconfont.css' because its MIME type ('text/html') ...

  5. Electron中提示:Refused to execute inline event handler because it violates

    场景 在Electron中点击index.html中的button按钮时想要其触发renderer.js的方法. 在index.html中 <button onclick="getPr ...

  6. 前端学习(2491):refused to apply style from ‘‘ because its MIME type (‘text/html‘) is not a supported sty

    <link type="text/css" rel="stylesheet" href="./main.css"> 加个type ...

  7. Refused to apply style from ‘http://localhost:63342/.../user.css‘ because its MIME type(‘text/html‘)

    HTML文件引用的css文件始终不生效,报这个错. 原因:引用的.css文件的href路径写错了.

  8. Jenkins运行selenium自动化测试脚本

    前提 1.Ubuntu上运行selenium的pytest脚本,已经成功运行 https://blog.csdn.net/weixin_43431593/article/details/1186359 ...

  9. web高德maker动画_Web Maker —我如何构建一个快速的离线前端游乐场

    web高德maker动画 by kushagra gour 由kushagra gour Web Maker -我如何构建一个快速的离线前端游乐场 (Web Maker - How I built a ...

  10. DVWA全关教程手册

    搭建 使用phpstudy 放入根目录下 C:\phpstudy\PHPTutorial\WWW 修改两个配置文件 C:\phpstudy\PHPTutorial\WWW\DVWA\php.ini m ...

最新文章

  1. Fastcgi是什么
  2. Isolation Forest原理总结
  3. c++ 截取\r\n问题
  4. Basic操作系统概念梳理
  5. C和指针之字符串strspn、strcspn函数源代码的实现
  6. Tomcat上下文JUnit @Rule
  7. CentOS7.2中安装rabbitmq
  8. 那些除夕夜还在上BOSS直聘的人
  9. nodejs模块hashmap
  10. paddlepaddle的使用
  11. Play Framework + ReactiveMongo 环境搭建
  12. 创建区块计算次数_以太坊创建者Vitalik Buterin为飙升的ETH交易费用提供扩展解决方案...
  13. Python代码自动转成C++代码
  14. Word控件Spire.Doc 转换教程(三):如何将 Word 转换为 PDF
  15. 洛谷P1512伊甸园的日历游戏题解
  16. javax.mail.MessagingException: Unknown SMTP host: smtp.163.com;
  17. Twitter是什么软件?哪个国家的?怎么使用?免费吗?
  18. 什么击计算机窗口可以打开资源管理器,Win8系统打开资源管理器窗口经常自动重启电脑解决措施...
  19. 惠普HP Deskjet F4238 多功能一体机驱动
  20. 相机平面与工作平面带夹角下的坐标换算

热门文章

  1. 十大门店进销存管理系统软件测评,秦丝长年稳居榜首
  2. Tensorflow2.0---SSD网络原理及代码解析(一)
  3. 云原生分布式数据库和数据仓库崛起背后的原因
  4. JAVA复习 (期末重点考点总结)
  5. 网络地址和广播地址的快速计算方法
  6. ArcGIS修改默认文件地理数据库
  7. Otsu算法——最大类间方差法(大津算法)
  8. OTSU算法实现二值化
  9. 迅捷CAD编辑器中PDF转换CAD的详细步骤
  10. 云之家集成第三方应用