Skip to content

Commit

Permalink
feat(root): add additional security header
Browse files Browse the repository at this point in the history
  • Loading branch information
spicyzboss committed Mar 31, 2024
1 parent ddd314b commit f43a587
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions apps/root/src/routes/plugin@security.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,22 @@
import { RequestHandler } from "@builder.io/qwik-city";

export const onRequest: RequestHandler = ({ headers }) => {
const permissions = [
'accelerometer=()',
'camera=()',
'geolocation=()',
'gyroscope=()',
'magnetometer=()',
'microphone=()',
'payment=()',
'usb=()'
];

const securityHeaders = {
'X-Frame-Options': 'sameorigin',
'X-XSS-Protection': '1; mode=block',
'Referrer-Policy': 'same-origin',
'Permissions-Policy': permissions.join('; '),
};

Object.entries(securityHeaders).map(([key, value]) => headers.set(key, value));
Expand Down

0 comments on commit f43a587

Please sign in to comment.