How do I modify this line of Nginx config to allow my website to serve and execute in-line Web-Assembly (wasm)?
add_header Content-Security-Policy "default-src 'self' http: https: ws: wss: data: blob: 'unsafe-inline'; frame-ancestors 'self';" always;
Error Message:
Content Security Policy: The page’s settings blocked the loading of a resource at wasm-eval (“default-src”).
So, I basically just tried adding wasm-eval
to my CSP, right before where it says 'unsafe-inline'
, but that didn’t work. How do I edit my CSP Header to allow inline Web Assembly (wasm)?
2
Answers
Not the best solution, but one solution is to add
'unsafe-eval'
to my CSP. So now the entire line of config looks like this:The above works, but maybe isn't great for security. Hopefully I can further update this question/answer in the future.
unsafe-wasm-eval
appears to be the only CSP option that all modern browsers supporthttps://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/script-src#unsafe_webassembly_execution