Skip to content

Commit ff64692

Browse files
committed
chore: remove middleware for COEP,COOP and CORP headers
These headers are only intented to use for static resources like html pages, js files and not for generic APIS. so thhese has to be always applied based on the route. This is best done as a nginx rule than to ever reach here. Selectiveley add to /www/ route only.
1 parent e7f9e63 commit ff64692

File tree

3 files changed

+1
-67
lines changed

3 files changed

+1
-67
lines changed

package-lock.json

Lines changed: 1 addition & 46 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@
6565
"@aicore/libcommonutils": "1.0.20",
6666
"@fastify/compress": "^8.0.1",
6767
"@fastify/cors": "^10.0.2",
68-
"@fastify/helmet": "^13.0.1",
6968
"@fastify/rate-limit": "^10.2.2",
7069
"@fastify/static": "8.1.0",
7170
"fastify": "5.2.1",

src/server.js

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,12 @@ import {HTTP_STATUS_CODES} from "@aicore/libcommonutils";
99
import {getConfigs} from "./utils/configs.js";
1010
import {getHelloSchema, hello, getHelloPostSchema, helloPost} from "./api/hello.js";
1111
import {fastifyStatic} from "@fastify/static";
12-
import helmet from '@fastify/helmet';
1312
import rateLimit from '@fastify/rate-limit';
1413
import cors from '@fastify/cors';
1514
import compression from '@fastify/compress';
1615

1716
import path from 'path';
1817
import {fileURLToPath} from 'url';
19-
import * as fs from "node:fs";
2018

2119
const __filename = fileURLToPath(import.meta.url);
2220
const __dirname = path.dirname(__filename);
@@ -43,24 +41,6 @@ server.register(compression, {
4341
threshold: 1024 // Only compress responses larger than 1KB
4442
});
4543

46-
// Register security plugins
47-
server.register(helmet, {
48-
contentSecurityPolicy: {
49-
directives: {
50-
defaultSrc: ["'self'"],
51-
styleSrc: ["'self'", "'unsafe-inline'"],
52-
imgSrc: ["'self'", 'data:', 'https:'],
53-
scriptSrc: ["'self'"],
54-
frameSrc: ["'none'"],
55-
objectSrc: ["'none'"],
56-
upgradeInsecureRequests: []
57-
}
58-
},
59-
crossOriginEmbedderPolicy: true,
60-
crossOriginOpenerPolicy: true,
61-
crossOriginResourcePolicy: true
62-
});
63-
6444
server.register(rateLimit, {
6545
max: 100,
6646
timeWindow: '1 minute',

0 commit comments

Comments
 (0)