Express Csp Runtime Config

How to pass server-side runtime config (API prefix, feature flags, user id, CSRF token) from an Express/EJS app to client JS when a strict Content-Security-Policy is in force (helmet default scriptSrc self, with no unsafe-inline). Use this whenever you need to inject a value the browser JS must read at runtime, but adding a script tag triggers a silent CSP block.

pedroiff0 Updated

File contents

pedroiff0/awesome-skills/tree/main/skills/web/express-csp-runtime-config commit c3bb4dde0f

Frequently asked questions

npx skillmds@latest add pedroiff0/express-csp-runtime-config