diff --git a/apps/chat/README.md b/apps/chat/README.md
index eef0d26a5..316ec43fa 100644
--- a/apps/chat/README.md
+++ b/apps/chat/README.md
@@ -131,6 +131,7 @@ AI DIAL Chat uses environment variables for configuration. All environment varia
| `SHOW_TOKEN_SUB` | No | Show token sub in refresh login error logs | `true`, `false` | `false` |
| `STORAGE_TYPE` | No | Type of storage used for getting and saving information generated by a user.
**Note**: currently, `api` is the only supported value. | `browserStorage`, `api` | `api` |
| `KEEP_ALIVE_TIMEOUT` | No | Determines the maximum time in milliseconds for an idle connection before it is closed by the server.
This is needed because infrastructures usually have a default keep alive timeout 60 seconds and the Next server should have a larger value.
**Note**: this variable is used only when running a `dockerfile`. | Any number string | `61000` |
+| `MAX_HTTP_HEADERS_SIZE` | No | Defines the maximum size of headers for Next.js server.
**Note**: this variable is used only when running a `dockerfile`. | `32768` |
| `MAX_PROMPT_TOKENS_DEFAULT_PERCENT` | No | A share in percent of `MAX_PROMPT_TOKENS_DEFAULT_VALUE`.
If not set, the value of `MAX_PROMPT_TOKENS_DEFAULT_VALUE` applies. | Any string | `75` |
| `MAX_PROMPT_TOKENS_DEFAULT_VALUE` | No | The default maximum limit of tokens permissible for any model.
Applies if a limit is not defined in the [AI DIAL Core](https://github.com/epam/ai-dial-core?tab=readme-ov-file#dynamic-settings) configuration. | Any string | `2000` |
| `CUSTOM_VISUALIZERS` | No | A list of configurations of custom visualizers.
Refer to [Chat Visualizer](../../libs/chat-visualizer-connector/README.md) to learn more. | [{ title, description, icon, contentType, url }] | |
diff --git a/package.json b/package.json
index 4afd524db..28309ae49 100644
--- a/package.json
+++ b/package.json
@@ -3,7 +3,7 @@
"version": "0.23.0-rc",
"private": true,
"scripts": {
- "nx": "nx",
+ "nx": "NODE_OPTIONS='--max-http-header-size=32768' nx",
"postinstall": "patch-package && node tools/patch-nextjs.js",
"graph": "nx graph",
"build": "nx run-many -t build",
diff --git a/startup.sh b/startup.sh
index de84e9f2b..6d42b92a6 100755
--- a/startup.sh
+++ b/startup.sh
@@ -1,5 +1,8 @@
#!/bin/sh
KEEP_ALIVE_TIMEOUT="${KEEP_ALIVE_TIMEOUT:-61000}"
+MAX_HTTP_HEADERS_SIZE="${MAX_HTTP_HEADERS_SIZE:-32768}"
-exec npm start -- --keepAliveTimeout $KEEP_ALIVE_TIMEOUT
+export NODE_OPTIONS="--max-http-header-size=$MAX_HTTP_HEADERS_SIZE ${NODE_OPTIONS}"
+
+exec npm start -- --keepAliveTimeout $KEEP_ALIVE_TIMEOUT
\ No newline at end of file