apt-cacher-ng: 406 Not Acceptable response with HTTPS

soeren asked:

I try to set up apt-cacher-ng to cache all apt packages for the local network. But with the graylog repository I have some trouble.

System: Debian 9 with apt 1.4.0 and apt-cacher-ng 2-2

On a server I just configured apt to use the apt-cacher server as a proxy (this is the only server with internet connection) with a line in /etc/apt/apt.conf.d/01proxy:

Acquire::http { Proxy ""; };

Now all apt-get updates and upgrades are getting their packages from the apt-cacher server. This works fine. Also I can just use a https repository using HTTPS/// in the URL like described in the manual.

The source.list looks like this:

deb http://HTTPS///artifacts.elastic.co/packages/5.x/apt stable main
deb http://repo.mongodb.org/apt/debian stretch/mongodb-org/4.0 main
deb http://HTTPS///packages.graylog2.org/repo/debian/ stable 2.5

The output of “apt-get update” on the server ends with:

Err:13 http://HTTPS///packages.graylog2.org/repo/debian stable/2.5 amd64 Packages 406 Not Acceptable
Ign:14 http://HTTPS///packages.graylog2.org/repo/debian stable/2.5 all Packages Reading package lists...
W: The repository 'http://HTTPS///packages.graylog2.org/repo/debian stable Release' does not have a Release file.
E: Failed to fetch http://HTTPS///packages.graylog2.org/repo/debian/dists/stable/2.5/binary-amd64/Packages 406 Not Acceptable
E: Some index files failed to download. They have been ignored, or old ones used instead.

In the apt-cacher-ng log the error is:

1548752476|I|224||packages.graylog2.org/repo/debian/dists/stable/2.5/binary-all/Packages [HTTP error, code: 406]
1548752476|E|237||packages.graylog2.org/repo/debian/dists/stable/2.5/binary-all/Packages [HTTP error, code: 406]

When I enable tunneling with PassThroughPattern in the acng.conf, the traffic is not cached but updates will work. Which isn’t the goal here, but shows that the network traffic should be working on my site.

Any help is highly appreciated.

My answer:

The repo you are trying to use with apt-cacher-ng is https://packages.graylog2.org/repo/debian/, so you have created your sources.list like:

deb http://HTTPS///packages.graylog2.org/repo/debian/ stable 2.5

The problem is that https://packages.graylog2.org/repo/debian/ is the wrong URL. The correct URL is https://packages.graylog2.org/debian.

So your sources line should appear like:

deb http://HTTPS///packages.graylog2.org/debian stable 2.5

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.