@@ -3,9 +3,7 @@ import path from 'path'
33
44import express from 'express'
55import type { NextFunction , Request , Response , Express } from 'express'
6- import timeout from 'connect-timeout'
76
8- import { haltOnDroppedConnection } from './halt-on-dropped-connection'
97import abort from './abort'
108import helmet from './helmet'
119import cookieParser from './cookie-parser'
@@ -65,14 +63,10 @@ import dynamicAssets from '@/assets/middleware/dynamic-assets'
6563import generalSearchMiddleware from '@/search/middleware/general-search-middleware'
6664import shielding from '@/shielding/middleware'
6765import safeRedirect from './safe-redirect'
68- import { MAX_REQUEST_TIMEOUT } from '@/frame/lib/constants'
6966import { initLoggerContext } from '@/observability/logger/lib/logger-context'
7067import { getAutomaticRequestLogger } from '@/observability/logger/middleware/get-automatic-request-logger'
7168import urlDecode from './url-decode'
7269
73- const { NODE_ENV } = process . env
74- const isTest = NODE_ENV === 'test' || process . env . GITHUB_ACTIONS === 'true'
75-
7670const ENABLE_FASTLY_TESTING = JSON . parse ( process . env . ENABLE_FASTLY_TESTING || 'false' )
7771
7872// Catch unhandled promise rejections and passing them to Express's error handler
@@ -90,8 +84,6 @@ const asyncMiddleware =
9084 }
9185
9286export default function index ( app : Express ) {
93- // *** Request connection management ***
94- if ( ! isTest ) app . use ( timeout ( MAX_REQUEST_TIMEOUT ) )
9587 app . use ( abort )
9688
9789 // Don't use the proxy's IP, use the requester's for rate limiting or
@@ -237,9 +229,6 @@ export default function index(app: Express) {
237229 app . use ( asyncMiddleware ( findPage ) ) // Must come before archived-enterprise-versions, breadcrumbs, featured-links, products, render-page
238230 app . use ( blockRobots )
239231
240- // Check for a dropped connection before proceeding
241- app . use ( haltOnDroppedConnection )
242-
243232 // *** Rendering, 2xx responses ***
244233 app . use ( '/api' , api )
245234 app . use ( '/llms.txt' , llmsTxt )
@@ -251,17 +240,11 @@ export default function index(app: Express) {
251240 // Now that the `req.language` is known, set it for the remaining endpoints
252241 app . use ( setLanguageFastlySurrogateKey )
253242
254- // Check for a dropped connection before proceeding (again)
255- app . use ( haltOnDroppedConnection )
256-
257243 app . use ( robots )
258244 app . use ( earlyAccessLinks )
259245 app . use ( '/categories.json' , asyncMiddleware ( categoriesForSupport ) )
260246 app . get ( '/_500' , asyncMiddleware ( triggerError ) )
261247
262- // Check for a dropped connection before proceeding (again)
263- app . use ( haltOnDroppedConnection )
264-
265248 // Specifically deal with HEAD requests before doing the slower
266249 // full page rendering.
267250 app . head ( '/*path' , fastHead )
@@ -292,9 +275,6 @@ export default function index(app: Express) {
292275 // handle serving NextJS bundled code (/_next/*)
293276 app . use ( next )
294277
295- // Check for a dropped connection before proceeding (again)
296- app . use ( haltOnDroppedConnection )
297-
298278 // *** Rendering, must go almost last ***
299279 app . get ( '/*path' , asyncMiddleware ( renderPage ) )
300280
0 commit comments