Skip to content

Directive: worker src

Ryan Parman edited this page Jun 14, 2024 · 7 revisions

Overview

The worker-src directive specifies valid sources for Worker, SharedWorker, or ServiceWorker scripts.

Affects: Web WorkersWorker, SharedWorker, and ServiceWorker

Required reading:

Usage examples

Accepts one or more schemes or hosts, the 'self' keyword, or the 'none' keyword.

worker-src 'none'
worker-src 'self'
worker-src example.com
worker-src example.com example.org
worker-src https://*.example.com
worker-src https:

Fallbacks

worker-src will fallback to child-src, which will fallback to script-src, which will fallback to default-src if it is undefined. Except for Chromium browsers, which will skip the child-src stage.

Possible errors

[ERROR] directive worker-src has an invalid value

See CSP-0100 for an explanation of this issue.

For developers

ABNF (CSP3)

directive-name  = "worker-src"
directive-value = serialized-source-list

See ABNF: serialized-source-list

Type

References

Clone this wiki locally