diff --git a/src/runtime/nitro/plugins/40-cspSsrNonce.ts b/src/runtime/nitro/plugins/40-cspSsrNonce.ts index d6081257..05de5890 100644 --- a/src/runtime/nitro/plugins/40-cspSsrNonce.ts +++ b/src/runtime/nitro/plugins/40-cspSsrNonce.ts @@ -2,12 +2,6 @@ import { defineNitroPlugin } from '#imports' import { resolveSecurityRules } from '../context' import { generateRandomNonce } from '../../../utils/crypto' -const LINK_RE = /]*?>)/gi -const NONCE_RE = /nonce="[^"]+"/i -const SCRIPT_RE = /]*?>)/gi -const STYLE_RE = /]*?>)/gi - - /** * This plugin generates a nonce for the current request and adds it to the HTML. * It only runs in SSR mode. @@ -58,20 +52,11 @@ export default defineNitroPlugin((nitroApp) => { return element; } // Add nonce to all link tags - element = element.replace(LINK_RE, (match, rest) => { - if (NONCE_RE.test(rest)) { - return match.replace(NONCE_RE, `nonce="${nonce}"`); - } - return ` { - return `