diff --git a/lib/upload.js b/lib/upload.js index 83dfa35b..82a16fdf 100644 --- a/lib/upload.js +++ b/lib/upload.js @@ -616,6 +616,14 @@ class BaseUpload { this._emitHttpError(req, res, 'tus: upload is currently locked; retry later') return } + if (inStatusCategory(status, 500)) { + // Run retry logic if the server has an error, e.g. 502 Bad Gateway when + // proxied server is temporarily down. See issue #579. + // Since we want to retry, do not clear `this.url` and do not + // create a new upload. + this._emitHttpError(req, res, 'tus: resuming upload resulted in HTTP 500 category error') + return + } if (inStatusCategory(status, 400)) { // Remove stored fingerprint and corresponding endpoint,