File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed
Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -162,7 +162,15 @@ module.exports = {
162162
163163 // Listen for the `error` event on `proxy`.
164164 proxy . on ( 'error' , function ( err , req , res ) {
165- json ( res , { error : `Proxy redirect error: ${ err . message } ` } ) ;
165+ // If the error is caused by a connection issue,
166+ // we actually simulate the same behavior by dropping the connection
167+ // because returning an error could make a NodeODM client assume that something failed
168+ if ( res . socket && ( err . code === 'ECONNRESET' || err . code === 'ECONNREFUSED' ) ) {
169+ logger . warn ( `Proxy redirect error: ${ err . message } ` ) ;
170+ res . socket . destroy ( ) ;
171+ } else {
172+ json ( res , { error : `Proxy redirect error: ${ err . message } ` } ) ;
173+ }
166174 } ) ;
167175
168176 // Added for CORS support
Original file line number Diff line number Diff line change 11{
22 "name" : " ClusterODM" ,
3- "version" : " 1.5.4 " ,
3+ "version" : " 1.5.5 " ,
44 "description" : " " ,
55 "main" : " index.js" ,
66 "scripts" : {
You can’t perform that action at this time.
0 commit comments