1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

getting error content-security-policy error: refused to create worker

Discussão em 'Angular' iniciado por Naresh Singh, Junho 24, 2025.

  1. Naresh Singh

    Naresh Singh Guest

    In my angular project. I'm getting below mentioned error

    refused to create a worker from 'blob:http://localhost:4200/d8633b89-9f70-4fd6-b08a-e369ccd34273' because it violates the following Content Security Policy directive: "script-src 'self' 'unsafe-eval' https://cdn.jsdelivr.net/npm/pdfjs-dist@2.5.207/es5/build/pdf.worker.js". Note that 'worker-src' was not explicitly set, so 'script-src' is used as a fallback.


    I know its related Content security policy. I have set up CSP. Here it is

    default-src 'self';
    script-src 'self' 'unsafe-eval' https://cdn.jsdelivr.net/npm/pdfjs-dist@2.5.207/es5/build/pdf.worker.js;
    style-src 'self' 'unsafe-inline' https://fonts.googleapis.com;
    img-src 'self' data: https://*.amazonaws.com;
    media-src 'self' data: https://*.amazonaws.com;
    connect-src 'self' http://localhost:* ws://localhost:*;
    font-src 'self' https://fonts.gstatic.com https://fonts.googleapis.com data:;
    childSrc blob
    worker-src blob:


    but I'm still getting error.

    Continue reading...

Compartilhe esta Página