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 = { ...@@ -320,6 +320,10 @@ const configSchema = {
profiling: { profiling: {
type: 'boolean', type: 'boolean',
}, },
proxyTimeout: {
minimum: 0,
type: 'number',
},
runtime: { runtime: {
// automatic typing doesn't like enum // automatic typing doesn't like enum
enum: ['experimental-edge', 'nodejs'] as any, enum: ['experimental-edge', 'nodejs'] as any,
......
...@@ -90,6 +90,7 @@ export interface ExperimentalConfig { ...@@ -90,6 +90,7 @@ export interface ExperimentalConfig {
cpus?: number cpus?: number
sharedPool?: boolean sharedPool?: boolean
profiling?: boolean profiling?: boolean
proxyTimeout?: number
isrFlushToDisk?: boolean isrFlushToDisk?: boolean
workerThreads?: boolean workerThreads?: boolean
pageEnv?: boolean pageEnv?: boolean
...@@ -550,6 +551,7 @@ export const defaultConfig: NextConfig = { ...@@ -550,6 +551,7 @@ export const defaultConfig: NextConfig = {
isrFlushToDisk: true, isrFlushToDisk: true,
workerThreads: false, workerThreads: false,
pageEnv: false, pageEnv: false,
proxyTimeout: undefined,
optimizeCss: false, optimizeCss: false,
nextScriptWorkers: false, nextScriptWorkers: false,
scrollRestoration: false, scrollRestoration: false,
......
...@@ -697,7 +697,10 @@ export default class NextNodeServer extends BaseServer { ...@@ -697,7 +697,10 @@ export default class NextNodeServer extends BaseServer {
ws: true, ws: true,
// we limit proxy requests to 30s by default, in development // we limit proxy requests to 30s by default, in development
// we don't time out WebSocket requests to allow proxying // 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) => { 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