Next.js Discord

Discord Forum

Subresource Integrity (Experimental) not working because of the inline scripts, lack of `integrity`

Unanswered
Schneider’s Smooth-fronted Caima… posted this in #help-forum
Open in Discord
Schneider’s Smooth-fronted CaimanOP
To reproduce:
- Set SRI as explained [here](https://nextjs.org/docs/app/guides/content-security-policy#subresource-integrity-experimental)

const nextConfig: NextConfig = {
  output: "standalone",
  /**
   * Hash-based CSP using Subresource Integrity (SRI)
   * Source: https://nextjs.org/docs/app/guides/content-security-policy#subresource-integrity-experimental
   */
  experimental: {
    sri: {
      algorithm: "sha256",
    },
  },
  async headers() {
    return [
      {
        source: "/(.*)",
        headers: [
          {
            key: "Content-Security-Policy",
            value: cspHeader.replace(/\n/g, ""),
          },
        ],
      },
    ];
  },
  turbopack: {},
...


- Run with next dev --webpack or next build --webpack


Problem:



Environment:
Operating system:
MacOS 13.7.8 (22H730)

Packages:
"next": "^16.0.1",


I know that I can try to use nonce with SSR, but I want to have SSG.

0 Replies