Added X-Frame-Options and CSP (#1690)

This commit is contained in:
Dan
2025-02-28 11:06:27 +00:00
committed by GitHub
parent e1db12b8ba
commit 5164935f9c
+7
View File
@@ -25,6 +25,13 @@ export default function handleRequest(
responseHeaders: Headers,
remixContext: EntryContext
) {
const url = new URL(request.url);
if (url.pathname.startsWith("/login")) {
responseHeaders.set("X-Frame-Options", "SAMEORIGIN");
responseHeaders.set("Content-Security-Policy", "frame-ancestors 'self'");
}
const acceptLanguage = request.headers.get("accept-language");
const locales = parseAcceptLanguage(acceptLanguage, {
validate: Intl.DateTimeFormat.supportedLocalesOf,