Unverified Commit fbf1c97e authored by Ben Heidemann's avatar Ben Heidemann Committed by GitHub

Add experimental proxy timeout option (#40289)

<!--
Thanks for opening a PR! Your contribution is much appreciated.
In order to make sure your PR is handled as smoothly as possible we
request that you follow the checklist sections below.
Choose the right checklist for the change that you're making:
-->

## Bug

- [X] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

Fixes #36251
parent abbe3b0a
......@@ -320,6 +320,10 @@ const configSchema = {
profiling: {
type: 'boolean',
},
proxyTimeout: {
minimum: 0,
type: 'number',
},
runtime: {
// automatic typing doesn't like enum
enum: ['experimental-edge', 'nodejs'] as any,
......
......@@ -90,6 +90,7 @@ export interface ExperimentalConfig {
cpus?: number
sharedPool?: boolean
profiling?: boolean
proxyTimeout?: number
isrFlushToDisk?: boolean
workerThreads?: boolean
pageEnv?: boolean
......@@ -550,6 +551,7 @@ export const defaultConfig: NextConfig = {
isrFlushToDisk: true,
workerThreads: false,
pageEnv: false,
proxyTimeout: undefined,
optimizeCss: false,
nextScriptWorkers: false,
scrollRestoration: false,
......
......@@ -697,7 +697,10 @@ export default class NextNodeServer extends BaseServer {
ws: true,
// we limit proxy requests to 30s by default, in development
// we don't time out WebSocket requests to allow proxying
proxyTimeout: upgradeHead && this.renderOpts.dev ? undefined : 30_000,
proxyTimeout:
upgradeHead && this.renderOpts.dev
? undefined
: this.nextConfig.experimental.proxyTimeout || 30_000,
})
await new Promise((proxyResolve, proxyReject) => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment