mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-05-26 20:49:55 +00:00
Security headers
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
import type { Handle } from "@sveltejs/kit";
|
||||
|
||||
const securityHeaders = {
|
||||
'X-Content-Type-Options': 'nosniff',
|
||||
'X-XSS-Protection': '0',
|
||||
|
||||
"Referrer-Policy": "no-referrer-when-downgrade",
|
||||
|
||||
"Permissions-Policy": "payment=(), geolocation=(self), notifications=(self), push=(self), fullscreen=(self)",
|
||||
|
||||
'Cross-Origin-Embedder-Policy': 'require-corp',
|
||||
'Cross-Origin-Opener-Policy': 'same-origin',
|
||||
'Cross-Origin-Resource-Policy': 'same-origin',
|
||||
|
||||
}
|
||||
|
||||
export const handle: Handle = async ({ event, resolve }) => {
|
||||
const response = await resolve(event);
|
||||
Object.entries(securityHeaders).forEach(
|
||||
([header, value]) => response.headers.set(header, value)
|
||||
);
|
||||
|
||||
response.headers.delete("x-sveltekit-page")
|
||||
|
||||
return response;
|
||||
}
|
||||
Reference in New Issue
Block a user