Movatterモバイル変換


[0]ホーム

URL:


  1. 개발자를 위한 웹 기술
  2. HTTP
  3. Reference
  4. HTTP 헤더
  5. Content-Security-Policy
  6. CSP: worker-src

This page was translated from English by the community.Learn more and join the MDN Web Docs community.

View in EnglishAlways switch to English

CSP: worker-src

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2022년 5월.

HTTPContent-Security-Policy (CSP)worker-src 지시문은Worker,SharedWorker, 또는ServiceWorker의 유효한 스크립트 소스를 지정합니다.

CSP 버전3
지시 형식Fetch directive
대비책

이 지시문이 없으면 사용자 에이전트는 먼저child-src 지시문을 찾은 다음script-src 지시문을 찾고, 마지막으로default-src 지시문을 찾습니다.

구문

worker-src 정책에 대해 하나 이상의 소스를 허용할 수 있습니다.

http
Content-Security-Policy: worker-src <source>;Content-Security-Policy: worker-src <source> <source>;

소스

<source>CSP Source Values에 나열된 값 중 하나입니다.

이 값은 모든fetch 지시문기타 여러 지시문에서 사용할 수 있습니다.

예제

위반 사례

주어진 CSP 해더가 다음과 같다면

http
Content-Security-Policy: worker-src https://example.com/

아래에서Worker,SharedWorker,ServiceWorker는 차단되어 로드되지 않습니다.

html
<script>  let blockedWorker = new Worker("data:application/javascript,…");  blockedWorker = new SharedWorker("https://not-example.com/");  navigator.serviceWorker.register("https://not-example.com/sw.js");</script>

명세서

Specification
Content Security Policy Level 3
# directive-worker-src

브라우저 호환성

같이 보기

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2026 Movatter.jp