diff --git a/src/app/runtime-config-script.js b/src/app/runtime-config-script.js index 0391f19..2a042fd 100644 --- a/src/app/runtime-config-script.js +++ b/src/app/runtime-config-script.js @@ -1,12 +1,18 @@ +import { headers } from 'next/headers'; import { getAnglesApiUrl, RUNTIME_CONFIG_GLOBAL } from '../utils/runtime-config'; // Server component. Rendered before any client code runs so that // `window.__ANGLES_CONFIG__` is populated by the time modules that read it // (e.g. the axios base URL in Shell.js) execute. -export default function RuntimeConfigScript() { +// +// Carries the request's CSP nonce (set by src/proxy.js); without it the policy blocks +// this inline script like any other. +export default async function RuntimeConfigScript() { const config = { anglesApiUrl: getAnglesApiUrl() }; + const nonce = (await headers()).get('x-nonce') || undefined; return (