Skip to content

Blacklist mirrors that give 5xx server errors

Dave Baxter requested to merge djb/apt-cacher-ng:debian/sid into debian/sid

Description

When using the backends mode of Apt-Cacher-NG, backends that give 5xx responses (e.g. 503 Service Unavailable) are treated equally to those returning 200 OK responses. As a result, Apt-Cacher-NG will cache these 5xx responses, without attempting to fetch the content from a different backend.

An example use case covered by this is having a list of repository upstream mirrors as backends. If one of these mirrors goes down temporarily, Apt-Cacher-NG will cache the response from this broken mirror and serve that, instead of trying other (potentially working) backends.

Changes

This merge request is a simple change that blacklists mirrors if they give a response with a status code >= 500 (i.e. a server error). In my testing, this resolves the issue, and a blacklisted mirror is also capable of being permitted again once it starts working as normal.

Merge request reports

Loading