fix: Avoid CSP related warnings in console on booking pages. (#14072)

This commit is contained in:
Hariom Balhara authored and GitHub committed 2024-03-15 15:42:10 +00:00
1 parent 71b0dd2aa3
commit 8fe8beb686
2 files changed
+9 -1

No files matched your search

+8 -1
View File
@@ -84,7 +84,14 @@ export function csp(req: IncomingMessage | NextRequest | null, res: OutgoingMess
const enforced =
"cache" in req ? req.headers.get("x-csp-enforce") === "true" : req.headers["x-csp-enforce"] === "true";
const name = enforced ? "Content-Security-Policy" : "Content-Security-Policy-Report-Only";
// No need to enable REPORT ONLY mode for CSP unless we start actively working on it. See https://github.com/calcom/cal.com/issues/13844
const name = enforced ? "Content-Security-Policy" : /*"Content-Security-Policy-Report-Only"*/ null;
if (!name) {
return {
nonce: undefined,
};
}
const value = getCspPolicy(nonce)
.replace(/\s{2,}/g, " ")