fix(dev-server): keep HTTP sockets alive through proxy request deadlines

This commit is contained in:
Clintchiz committed 2026-08-26 17:48:49 +05:30
1 parent 9e0907ffb2
commit 43bc2330b2
4 files changed
+6 -2

No files matched your search

+1 -1
View File
@@ -357,7 +357,7 @@
}, },
"packages/dev-server": { "packages/dev-server": {
"name": "@wrnexus/dev-server", "name": "@wrnexus/dev-server",
"version": "0.8.58", "version": "0.8.59",
"dependencies": { "dependencies": {
"@wrnexus/authz": "workspace:*", "@wrnexus/authz": "workspace:*",
"@wrnexus/cache": "workspace:*", "@wrnexus/cache": "workspace:*",
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@wrnexus/dev-server", "name": "@wrnexus/dev-server",
"version": "0.8.58", "version": "0.8.59",
"type": "module", "type": "module",
"main": "src/index.ts", "main": "src/index.ts",
"exports": { "exports": {
+2
View File
@@ -654,6 +654,8 @@ export async function startGateway(opts: GatewayOptions): Promise<RunningGateway
port, port,
hostname, hostname,
development: mode === "development", development: mode === "development",
// Keep the socket alive long enough to return the configured proxy timeout.
idleTimeout: Math.min(255, Math.max(35, Math.ceil((limits.timeoutMs ?? 30_000) / 1000) + 5)),
maxRequestBodySize: maxBodyBytes, maxRequestBodySize: maxBodyBytes,
async fetch(req, srv) { async fetch(req, srv) {
const url = new URL(req.url); const url = new URL(req.url);
+2
View File
@@ -634,6 +634,8 @@ export async function startServer(opts: ServeOptions): Promise<RunningServer> {
port, port,
hostname, hostname,
development: mode === "development", development: mode === "development",
// Cold page compilation can exceed Bun's default connection idle window.
idleTimeout: 35,
maxRequestBodySize: 10 * 1024 * 1024, maxRequestBodySize: 10 * 1024 * 1024,
...(opts.tls ? { tls: opts.tls } : {}), ...(opts.tls ? { tls: opts.tls } : {}),
fetch(request, server) { fetch(request, server) {