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
This commit is contained in:
parent
abbe3b0ad4
commit
fbf1c97eac
3 changed files with 10 additions and 1 deletions
|
@ -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) => {
|
||||
|
|
Loading…
Reference in a new issue