fix: Add CORP and COEP headers to embedded pages (#15275)

* Add CORP headers

* Improve test

* Add unit tests as well

---------

Co-authored-by: Keith Williams <[email protected]>
This commit is contained in:
Hariom BalharaandKeith Williams authored and GitHub committed 2024-07-29 11:54:31 +02:00
1 parent 6e66f7f8f8
commit 37caa57798
12 files changed
+302 -21

No files matched your search

+4 -1
View File
@@ -14,7 +14,10 @@ export default function withEmbedSsrAppDir<T extends Record<string, any>>(
) {
return async (context: GetServerSidePropsContext): Promise<T> => {
const { embed, layout } = context.query;
const isCOEPEnabled = context.query["flag.coep"] === "true";
if (isCOEPEnabled) {
context.res.setHeader("Cross-Origin-Embedder-Policy", "require-corp");
}
try {
const props = await getData(context);