From 14150e7067ebcb272a3b1f9c7eae4da377b7fc52 Mon Sep 17 00:00:00 2001 From: Richard Poelderl Date: Mon, 17 Apr 2023 16:55:12 +0200 Subject: [PATCH] remove CustomHeader and set the policy via the `meta` for entire doc --- apps/web/pages/_document.tsx | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/apps/web/pages/_document.tsx b/apps/web/pages/_document.tsx index a4d5488c66..1b9254c304 100644 --- a/apps/web/pages/_document.tsx +++ b/apps/web/pages/_document.tsx @@ -1,7 +1,6 @@ import type { DocumentContext, DocumentProps } from "next/document"; import Document, { Head, Html, Main, NextScript } from "next/document"; import Script from "next/script"; -import { cloneElement } from "react"; import { z } from "zod"; import { getDirFromLang } from "@calcom/lib/i18n"; @@ -9,17 +8,6 @@ import { getDirFromLang } from "@calcom/lib/i18n"; import { csp } from "@lib/csp"; type Props = Record & DocumentProps; -// So that bots without referrer header have the referrerpolicy set explicitly by the script tag -class CustomHead extends Head { - getScripts(files: Parameters[0]) { - const originalScripts = super.getScripts(files); - return originalScripts.map((script) => { - return cloneElement(script, { - referrerpolicy: "strict-origin-when-cross-origin", - }); - }); - } -} class MyDocument extends Document { static async getInitialProps(ctx: DocumentContext) { @@ -46,19 +34,21 @@ class MyDocument extends Document { const dir = getDirFromLang(locale); return ( - + + {/* So that our rewrite logic depending on the `referrer` header is always set: */} + - +