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

This commit is contained in:
Hariom Balhara
2024-03-15 15:42:10 +00:00
committed by GitHub
parent 71b0dd2aa3
commit 8fe8beb686
2 changed files with 9 additions and 1 deletions
+1
View File
@@ -232,6 +232,7 @@ NEXT_PUBLIC_COMPANY_NAME="Cal.com, Inc."
# NEXT_PUBLIC_DISABLE_SIGNUP=true
NEXT_PUBLIC_DISABLE_SIGNUP=
# Set this to 'non-strict' to enable CSP for support pages. 'strict' isn't supported yet. Also, check the README for details.
# Content Security Policy
CSP_POLICY=
+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, " ")