rails email preview / Policy directive:" style-src' unsafe-inline'"

时间:2018-06-04 13:20:06

标签: ruby-on-rails actionmailer preview

使用电子邮件预览中内置的rails时获取以下信息:

    Refused to load the stylesheet
   'http://app.lvh.me:3000/packs/...' because it violates
    the following Content Security
    Policy directive: "style-src 'unsafe-inline'".

结束在标题中添加以下内容:

meta http-equiv="Content-Security-Policy"
     content="default-src *; style-src 'self' http://* 'unsafe-inline'; script-src 'self' http://* 'unsafe-inline' 'unsafe-eval';"

但仍然遇到问题

有没有人遇到并解决了这个问题?

1 个答案:

答案 0 :(得分:0)

显然,通过解释为什么会发生这种情况,可以增强这个答案, 但到目前为止似乎解决方法是添加以下gem:

gem 'premailer-rails'

As explained here.