由于违反内容安全策略,话语电子邮件激活不再有效
discourse email activation no longer works due to Content Security Policy violation
我使用我的自定义 app.yml
增强了话语,它使用 cloudflare 模板,如下所示:
templates:
- "templates/postgres.template.yml"
- "templates/redis.template.yml"
- "templates/web.template.yml"
- "templates/web.ratelimited.template.yml"
- "templates/web.socketed.template.yml"
- "templates/sshd.template.yml"
- "templates/cloudflare.template.yml"
然后我像这样引导图像:
./launcher bootstrap app &&\
./launcher start app
然后我注册了我的帐户,并尝试点击我的讨论页面上的激活 link,但没有任何反应。查看开发工具,我看到这个错误:
Refused to execute inline script because it violates the following Content Security Policy directive: "script-src 'unsafe-eval' 'report-sample' http://myfancydomain.com/logs/ http://myfancydomain.com/sidekiq/ http://myfancydomain.com/mini-profiler-resources/ http://myfancydomain.com/assets/ http://myfancydomain.com/brotli_asset/ http://myfancydomain.com/extra-locales/ http://myfancydomain.com/highlight-js/ http://myfancydomain.com/javascripts/ http://myfancydomain.com/plugins/ http://myfancydomain.com/theme-javascripts/ http://myfancydomain.com/svg-sprite/". Either the 'unsafe-inline' keyword, a hash ('sha256-T1n9N/v2ZUyCGncqaO0MgcESijK4iDg9nXYaamEO+bY='), or a nonce ('nonce-...') is required to enable inline execution.
我不知道这个错误是什么意思 - 任何关于如何解决它的线索都会很好。
您已经包含了 cloudflare 模板,这可能意味着您将其用于 SSL。
但是您的 CSP 拥有所有 http 方案,而不是 https。如果您通过 https 访问,但 CSP 说是 http,那就是不匹配。
如果是这种情况,您需要告诉 Discourse 它在 https 之后。尝试:
SiteSetting.force_https = true
在 rails 控制台。
我使用我的自定义 app.yml
增强了话语,它使用 cloudflare 模板,如下所示:
templates:
- "templates/postgres.template.yml"
- "templates/redis.template.yml"
- "templates/web.template.yml"
- "templates/web.ratelimited.template.yml"
- "templates/web.socketed.template.yml"
- "templates/sshd.template.yml"
- "templates/cloudflare.template.yml"
然后我像这样引导图像:
./launcher bootstrap app &&\
./launcher start app
然后我注册了我的帐户,并尝试点击我的讨论页面上的激活 link,但没有任何反应。查看开发工具,我看到这个错误:
Refused to execute inline script because it violates the following Content Security Policy directive: "script-src 'unsafe-eval' 'report-sample' http://myfancydomain.com/logs/ http://myfancydomain.com/sidekiq/ http://myfancydomain.com/mini-profiler-resources/ http://myfancydomain.com/assets/ http://myfancydomain.com/brotli_asset/ http://myfancydomain.com/extra-locales/ http://myfancydomain.com/highlight-js/ http://myfancydomain.com/javascripts/ http://myfancydomain.com/plugins/ http://myfancydomain.com/theme-javascripts/ http://myfancydomain.com/svg-sprite/". Either the 'unsafe-inline' keyword, a hash ('sha256-T1n9N/v2ZUyCGncqaO0MgcESijK4iDg9nXYaamEO+bY='), or a nonce ('nonce-...') is required to enable inline execution.
我不知道这个错误是什么意思 - 任何关于如何解决它的线索都会很好。
您已经包含了 cloudflare 模板,这可能意味着您将其用于 SSL。
但是您的 CSP 拥有所有 http 方案,而不是 https。如果您通过 https 访问,但 CSP 说是 http,那就是不匹配。
如果是这种情况,您需要告诉 Discourse 它在 https 之后。尝试:
SiteSetting.force_https = true
在 rails 控制台。