Content Security Policy Blocks K3
Symptoms
After embedding the K3 configurator, error messages such as the following appear in the browser console:
Creating a worker from 'blob:https://www.example.com/...' violates the
following Content Security Policy directive: "script-src 'self' ...".
Note that 'worker-src' was not explicitly set, so 'script-src' is used
as a fallback. The action has been blocked.
The configurator does not load completely or displays errors.
Cause
Many websites use Content Security Policy (CSP) as a security measure. CSP defines which resources (scripts, styles, images, etc.) may be loaded from which sources.
K3 uses Web Workers for background operations (e.g., 3D rendering, calculations) to prevent the user interface from being blocked. These workers are created as so-called Blob URLs—a common technique in modern web applications.
If the website’s CSP does not explicitly allow blob:, the browser will block the creation of these workers.
Solution
The Content Security Policy must be extended to include blob:.
Recommended Approach (Specific to Workers)
If your CSP can define worker-src separately:
worker-src 'self' blob:;
This approach is more secure because it allows blob: only for Web Workers.
Alternative Option (in script-src)
If worker-src cannot be defined separately, blob: must be added to script-src:
script-src 'self' https://k3.objectcode.de blob:;
The Content Security Policy is typically configured in one of the following locations:
- HTTP headers on the web server (Apache, Nginx, etc.)
- Meta tag in the website’s HTML header
- E-commerce platform or CMS settings (e.g., Shopware, WordPress plugins)
- Hosting provider security settings
Contact your webmaster or hosting provider if you are unsure.
Security Note
Is blob: a security risk?
Adding blob: allows the browser to execute code from binary data objects stored in memory.
If your CSP already includes the following directives, blob: does not significantly increase the risk:
| Directive | Meaning | Risk |
|---|---|---|
'unsafe-inline' | Allows inline scripts in HTML | Higher |
'unsafe-eval' | Allows eval() and string-to-code conversion | Higher |
blob: | Allows blob URLs for workers | Lower |
Most modern web applications with 3D rendering or complex calculations require Web Workers and thus blob: support.
Complete CSP Example
A minimal CSP for K3 might look like this:
default-src 'self';
script-src 'self' https://k3.objectcode.de 'unsafe-inline' 'unsafe-eval';
worker-src 'self' blob:;
style-src 'self' 'unsafe-inline';
img-src 'self' https://k3.objectcode.de https://d2mb1ky72vpspf.cloudfront.net https://oc-k3.s3.eu-central-1.amazonaws.com data: blob:;
connect-src 'self' https://k3.objectcode.de https://k3-api.objectcode.de https://d2mb1ky72vpspf.cloudfront.net https://oc-k3.s3.eu-central-1.amazonaws.com;
font-src 'self' https://k3.objectcode.de;
You can view CSP issues in the browser developer tools (F12) under "Console" or "Network." Blocked resources are displayed there with corresponding error messages.