4
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

JenkinsでStoryBookとかJavaDoc表示したいときのContent Security Policy

Last updated at Posted at 2017-03-08

JenkinsのHTML PublisherでStoryBookとかJavaDoc表示しようとしていつもハマるのでメモ

とりあえず許可するには管理 > スクリプトコンソールに以下を入力

System.setProperty("hudson.model.DirectoryBrowserSupport.CSP", "default-src 'self'; img-src 'self' data:; style-src 'self' 'unsafe-inline'; child-src 'self'; frame-src 'self'; script-src 'self' 'unsafe-inline';")
  • webpackとかで画像をbase64エンコードして使ってる場合はimg-src 'self' data:が必要
  • inline css使ってるときはstyle-src 'self' 'unsafe-inline'が必要
  • scriptタグとか使うとき?はscript-src 'self' 'unsafe-inline'が必要

chromeは明示的にキャッシュ破棄して再読込しないと反映されないので注意

参考URL: https://developer.mozilla.org/ja/docs/Web/Security/CSP/CSP_policy_directives

4
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?