File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -397,14 +397,14 @@ export class ConfigurableProxy extends EventEmitter {
397397 proxyOptions . secure = false ;
398398 proxyOptions . target . socketPath = decodeURIComponent ( target . host ) ;
399399 proxyOptions . target . pathname = ( target . pathname ? target . pathname + "/" : "" ) + reqUrl ;
400+ } else if ( target . protocol . startsWith ( "https" ) ) {
401+ proxyOptions . secure = true ;
402+ proxyOptions . agent = this . httpsAgent ;
403+ } else if ( target . protocol . startsWith ( "http" ) ) {
404+ proxyOptions . secure = false ;
405+ proxyOptions . agent = this . httpAgent ;
400406 } else {
401- proxyOptions . secure = target . protocol . slice ( - 2 ) === "s:" ;
402-
403- if ( proxyOptions . secure ) {
404- proxyOptions . agent = this . httpsAgent ;
405- } else {
406- proxyOptions . agent = this . httpAgent ;
407- }
407+ throw new Error ( `Unexpected protocol ${ target . protocol } ` ) ;
408408 }
409409
410410 if ( proxyOptions . secure && this . options . clientSsl ) {
You can’t perform that action at this time.
0 commit comments