diff --git a/cmd/linkcheck/links.go b/cmd/linkcheck/links.go index d83b3ae7bac..4930b9bb33b 100644 --- a/cmd/linkcheck/links.go +++ b/cmd/linkcheck/links.go @@ -129,7 +129,10 @@ func newWalkFunc(invalidLink *bool, client *http.Client) filepath.WalkFunc { if err != nil { break } - if resp.StatusCode == http.StatusTooManyRequests { + // This header is used in 301, 429 and 503. + // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After + // And Go client will follow redirects automatically so the 301 check is probably unnecessary. + if resp.StatusCode == http.StatusTooManyRequests || resp.StatusCode == http.StatusServiceUnavailable { retryAfter := resp.Header.Get("Retry-After") if seconds, err := strconv.Atoi(retryAfter); err != nil { backoff = seconds + 10