Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix HEAD not being retried for HTTP 500 category responses #581

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions lib/upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please mention that we do not want to clear this._url and create a new upload here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

// 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,
Expand Down