* Middleware only logic to add CSP header as Next.js App Router doesnt allow setting header in server component * add tests * Remove nonce from Page Router and fix ts issues * Add checkly test
34 lines
772 B
TypeScript
34 lines
772 B
TypeScript
import { _generateMetadata } from "app/_utils";
|
|
import { headers } from "next/headers";
|
|
|
|
import PageWrapper from "@components/PageWrapperAppDir";
|
|
|
|
import { NotFound } from "./notFoundClient";
|
|
|
|
export const generateMetadata = async () => {
|
|
const metadata = await _generateMetadata(
|
|
(t) => t("404_page_not_found"),
|
|
(t) => t("404_page_not_found")
|
|
);
|
|
return {
|
|
...metadata,
|
|
robots: {
|
|
index: false,
|
|
follow: false,
|
|
},
|
|
};
|
|
};
|
|
|
|
const ServerPage = async () => {
|
|
const h = await headers();
|
|
const nonce = h.get("x-csp-nonce") ?? undefined;
|
|
const host = h.get("x-forwarded-host") ?? "";
|
|
|
|
return (
|
|
<PageWrapper requiresLicense={false} nonce={nonce}>
|
|
<NotFound host={host} />
|
|
</PageWrapper>
|
|
);
|
|
};
|
|
export default ServerPage;
|