@@ -73,6 +73,11 @@ export const forward = async (
7373 lookup : handlerOpts . dnsLookup ,
7474 } ;
7575
76+ const commonOpts : http . RequestOptions = {
77+ timeout : 200_000 , // 200 seconds
78+ ...options ,
79+ } ;
80+
7681 // In case of proxy the path needs to be an absolute URL
7782 if ( proxy ) {
7883 options . path = request . url ;
@@ -120,18 +125,15 @@ export const forward = async (
120125 }
121126 } ;
122127
128+ const httpsOpts = {
129+ ...commonOpts ,
130+ rejectUnauthorized : handlerOpts . upstreamProxyUrlParsed ? ! handlerOpts . ignoreUpstreamProxyCertificate : undefined ,
131+ } ;
132+
123133 // We have to force cast `options` because @types/node doesn't support an array.
124134 const client = origin ! . startsWith ( 'https:' )
125- ? https . request ( origin ! , {
126- ...options as unknown as https . RequestOptions ,
127- rejectUnauthorized : handlerOpts . upstreamProxyUrlParsed ? ! handlerOpts . ignoreUpstreamProxyCertificate : undefined ,
128- agent : handlerOpts . httpsAgent ,
129- } , requestCallback )
130-
131- : http . request ( origin ! , {
132- ...options as unknown as http . RequestOptions ,
133- agent : handlerOpts . httpAgent ,
134- } , requestCallback ) ;
135+ ? https . request ( origin ! , httpsOpts , requestCallback )
136+ : http . request ( origin ! , commonOpts , requestCallback ) ;
135137
136138 response . once ( 'close' , ( ) => {
137139 const {
0 commit comments