Video from a MediaSource is blocked: 'Content at ... may not load data from blob:'
Content at http://localhost:3000/ may not load data from blob:http://localhost:3000/...Short answer
A MediaSource video plays from a blob: URL. If your Content-Security-Policy has no media-src, the browser uses default-src, and 'self' does not cover blob:. Add blob: to media-src (and to worker-src if a blob worker is blocked). Check that no second policy, such as a meta tag, still blocks it.
Fix it fast
1Find out which cause you have
Print the policy the server really sends and look for media-src. If it is missing, default-src is what blocks the blob: URL.
curl -sI http://localhost:3000/ | grep -i "content-security-policy" | tr ';' '\n' | grep -iE "default-src|media-src|worker-src|child-src"2Match what you see, then jump to its fix
- 1
The console names media-src, or default-src when the policy has no media-src.media-src is missing and default-src does not list blob:Fix - 2
The blocked resource is a blob: URL and the directive named is worker-src, child-src or script-src.The blob: URL belongs to a worker, and worker-src blocks itFix - 3
You added blob: to the header but the same violation message keeps appearing.A second policy is also enforced and it still blocks blob:Fix
- 1
What does the error look like?
Content at http://localhost:3000/ may not load data from blob:http://localhost:3000/...Content-Security-Policy: The page's settings blocked the loading of a resource (media-src) at blob:http://localhost:3000/...
Cause 1 of 3
media-src is missing and default-src does not list blob:
1Check
MDN says media-src covers audio and video elements, and that the browser falls back to default-src when media-src is absent. The CSP specification says non-HTTP schemes must be named in a source expression. A policy of default-src 'self' therefore does not allow blob: URLs.
curl -sI http://localhost:3000/ | grep -i "content-security-policy" | tr ';' '\n' | grep -iE "default-src|media-src"2Fix
Add an explicit media-src that includes the blob: scheme next to your own origin.
Content-Security-Policy: default-src 'self'; media-src 'self' blob:3Verify
Reload the page with the cache disabled and start the video. The console should show no new violation.
curl -sI http://localhost:3000/ | grep -i "media-src"Confirmed by developer.mozilla.org
Cause 2 of 3
The blob: URL belongs to a worker, and worker-src blocks it
1Check
MDN lists the fallback order for worker-src as child-src, then script-src, then default-src. If your player starts a Worker from a blob: URL, the first of those directives that exists must allow blob:.
curl -sI http://localhost:3000/ | grep -i "content-security-policy" | tr ';' '\n' | grep -iE "worker-src|child-src|script-src"2Fix
Put blob: in worker-src. That one directive controls Worker, SharedWorker and ServiceWorker scripts, so you do not have to loosen script-src.
Content-Security-Policy: default-src 'self'; media-src 'self' blob:; worker-src 'self' blob:3Verify
Reload and watch the console while the player starts.
curl -sI http://localhost:3000/ | grep -i "worker-src"Confirmed by developer.mozilla.org
Cause 3 of 3
A second policy is also enforced and it still blocks blob:
1Check
The CSP specification says multiple policies can apply to one resource, and each enforced policy must pass. A policy in a meta tag, or one added by a proxy or a framework, is checked in addition to your header.
curl -s http://localhost:3000/ | grep -i "http-equiv=.content-security-policy"
curl -sI http://localhost:3000/ | grep -ic "content-security-policy"2Fix
Keep one source of truth. Remove the meta tag or the extra header, or add blob: to every enforced policy.
<!-- delete this line, or add media-src 'self' blob: to it -->
<meta http-equiv="Content-Security-Policy" content="default-src 'self'">3Verify
Reload the page. Only one policy should show in the response headers and the video should load.
curl -sI http://localhost:3000/ | grep -i "content-security-policy"Confirmed by w3.org
How do I stop it coming back?
- List media-src and worker-src explicitly in every policy, instead of relying on the default-src fallback.
- Try policy changes with Content-Security-Policy-Report-Only first, then enforce.
- Keep the policy in one place, so a header and a meta tag cannot disagree.
- Test video in Firefox as well as Chrome when you change the policy.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Related fixes
Security
The browser blocks a script because of your Content Security Policy
Refused to execute inline script because it violates the following Content Security Policy directive: "script-src 'self'". Either the 'unsafe-inline' keyword, a hash ('sha256-...'), or a nonce ('nonce-...') is required to enable inline execution.
The page's Content-Security-Policy does not allow what it tried to run or load.
5 causes, each with a fixSecurity
Inline base64 images do not show because of the Content Security Policy
Refused to load the image 'data:image/svg+xml;base64,...' because it violates the following Content Security Policy directive: "default-src 'self'".
A base64 image has a data: URL, and a policy such as default-src 'self' does not allow that scheme.
3 causes, each with a fixSecurity
The browser refuses to load a font because of your Content Security Policy
Note that 'font-src' was not explicitly set, so 'default-src' is used as a fallback.
A font is blocked when the font-src directive, or default-src when font-src is missing, does not allow where the font comes from.
3 causes, each with a fixSecurity
PHP LDAP in Laravel fails with Can't contact LDAP server over TLS
unable to get local issuer certificate
PHP's LDAP client uses OpenLDAP's settings.
3 causes, each with a fixSecurity
Your auth.log is full of Failed password and Invalid user attempts
Invalid user ubnt from 198.51.100.23 port 40122
Any public SSH port gets password guesses within hours; the log lines alone are not a breach.
4 causes, each with a fixSecurity
Entra ID token request fails: the request body must contain the parameter 'grant_type'
AADSTS900144: The request body must contain the following parameter: 'grant_type'.
The token endpoint did not find grant_type in the form body of your POST.
3 causes, each with a fix