From 43e8d921e7ba41391cc62c0f429193c7fa6ad5f4 Mon Sep 17 00:00:00 2001 From: Soumyadip Chowdhury Date: Wed, 11 Dec 2024 10:34:56 +0530 Subject: [PATCH 1/3] chore(reverse-proxy) : changes discarded for the HTTP header limit --- packages/reverse-proxy-service/src/server.ts | 5 ----- packages/reverse-proxy-service/src/types/http.d.ts | 7 ------- packages/reverse-proxy-service/tsconfig.json | 5 +---- 3 files changed, 1 insertion(+), 16 deletions(-) delete mode 100644 packages/reverse-proxy-service/src/types/http.d.ts diff --git a/packages/reverse-proxy-service/src/server.ts b/packages/reverse-proxy-service/src/server.ts index deadb0996..c48d8e8fe 100644 --- a/packages/reverse-proxy-service/src/server.ts +++ b/packages/reverse-proxy-service/src/server.ts @@ -12,11 +12,6 @@ import store from './setup/store'; import { COOKIE_SECRET } from './setup/env'; import oidcAuth from './middleware/oidcAuth'; import { updateApplicationCache } from './utils/applicationCache'; -import http from 'http'; - -const MAX_HEADER_SIZE = 16 * 1024 * 1024; // 16MB - -( http.globalAgent as http.Agent ).maxHeaderSize = MAX_HEADER_SIZE; const getServer = async () => { const server = express(); diff --git a/packages/reverse-proxy-service/src/types/http.d.ts b/packages/reverse-proxy-service/src/types/http.d.ts deleted file mode 100644 index 3edfd5153..000000000 --- a/packages/reverse-proxy-service/src/types/http.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -import * as http from 'http'; - -declare module 'http' { - interface Agent { - maxHeaderSize?: number; - } -} diff --git a/packages/reverse-proxy-service/tsconfig.json b/packages/reverse-proxy-service/tsconfig.json index 7a71c16aa..49a94af48 100644 --- a/packages/reverse-proxy-service/tsconfig.json +++ b/packages/reverse-proxy-service/tsconfig.json @@ -50,10 +50,7 @@ // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ - "typeRoots": [ - "src/types", - "node_modules/@types" - ], + // "typeRoots": [], // "types": [], /* Type declaration files to be included in compilation. */ // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ From d5bf5ca6272f327a6b879e0db28edaaa39b25434 Mon Sep 17 00:00:00 2001 From: Soumyadip Chowdhury Date: Wed, 11 Dec 2024 10:35:28 +0530 Subject: [PATCH 2/3] chore(reverse-proxy): max header added in the package.json --- packages/reverse-proxy-service/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/reverse-proxy-service/package.json b/packages/reverse-proxy-service/package.json index 30eb63664..365bdf3f4 100644 --- a/packages/reverse-proxy-service/package.json +++ b/packages/reverse-proxy-service/package.json @@ -5,7 +5,7 @@ "main": "src/index.ts", "scripts": { "start": "npm run serve", - "serve": "node dist/index.js", + "serve": "node --max-http-header-size=33554432 dist/index.js", "dev": "nodemon", "prebuild": "rimraf dist", "build": "tsc", From e386f6a41f64a595d9046b56ebb1b7be4f11631d Mon Sep 17 00:00:00 2001 From: Soumyadip Chowdhury Date: Wed, 11 Dec 2024 16:16:35 +0530 Subject: [PATCH 3/3] chore(reverse-proxy) : changes in docker file and the header size --- packages/reverse-proxy-service/Dockerfile | 2 +- packages/reverse-proxy-service/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/reverse-proxy-service/Dockerfile b/packages/reverse-proxy-service/Dockerfile index 5470da551..96fdc261f 100644 --- a/packages/reverse-proxy-service/Dockerfile +++ b/packages/reverse-proxy-service/Dockerfile @@ -20,4 +20,4 @@ COPY --from=builder $HOME/.env.example . EXPOSE 8080 -CMD ["node", "dist/index.js"] +CMD ["node", "--max-http-header-size=10485760", "dist/index.js"] diff --git a/packages/reverse-proxy-service/package.json b/packages/reverse-proxy-service/package.json index 365bdf3f4..92cef53ac 100644 --- a/packages/reverse-proxy-service/package.json +++ b/packages/reverse-proxy-service/package.json @@ -5,7 +5,7 @@ "main": "src/index.ts", "scripts": { "start": "npm run serve", - "serve": "node --max-http-header-size=33554432 dist/index.js", + "serve": "node --max-http-header-size=10485760 dist/index.js", "dev": "nodemon", "prebuild": "rimraf dist", "build": "tsc",