Apt-cacher-ng + privoxy + flatpak/hub does not work

Hi, I use a sys-apt-cacher-ng, which uses privoxy, i followed this guide for setting this up. I use saltstack to create my qubes. I purposefully deleted my current flatpak vm and used saltstack to create the same qube again. I used Solenes Guide as inspiration when writing my saltstack states. However

export all_proxy=http://127.0.0.1:8082/
flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo

fails if i use sys-apt-cacher-ng with privoxy with this error:

error: Can't load uri https://dl.flathub.org/repo/flathub.flatpakrepo: While fetching https://dl.flathub.org/repo/flathub.flatpakrepo: [56] Failure when receiving data from peer

There are no logs in /var/log/apt-cacher-ng/apt-cacher.log for this call, in /var/log/apt-cacher-ng/apt-cacher.err is only this:

Fri May  9 22:04:09 2025|Detected incoming connection from the TCP socket
Fri May  9 22:04:09 2025|Client name: 127.0.0.1:59224

I tried changing using http instead of https for debugging but then I get this:

error: Can't load uri http://dl.flathub.org/repo/flathub.flatpakrepo: Server returned status 403

this also does not work, but apt-cacher has a log for it in /var/log/apt-cacher-ng/apt-cacher.log: 1746820580|O|679|127.0.0.1|/repo/flathub.flatpakrepo and in /var/log/apt-cacher-ng/apt-cacher.err:

Fri May  9 22:04:49 2025|Detected incoming connection from the TCP socket
Fri May  9 22:04:49 2025|Client name: 127.0.0.1:35280
Fri May  9 22:04:49 2025|Decoded request URI: http://HTTPS///dl.flathub.org/repo/flathub.flatpakrepo

in /var/log/privoxy/logfile is nothing interesting for both calls:

2025-05-09 21:57:55.025 70241006e080 Info: exiting by signal 15 .. bye
2025-05-09 21:57:55.031 745251a8a080 Info: Privoxy version 3.0.34
2025-05-09 21:57:55.031 745251a8a080 Info: Program name: /usr/sbin/privoxy
2025-05-09 21:57:55.031 745251a8a080 Info: Loading filter file: /etc/privoxy/default.filter
2025-05-09 21:57:55.033 745251a8a080 Info: Loading filter file: /etc/privoxy/user.filter
2025-05-09 21:57:55.033 745251a8a080 Info: Loading actions file: /etc/privoxy/match-all.action
2025-05-09 21:57:55.033 745251a8a080 Info: Loading actions file: /etc/privoxy/default.action
2025-05-09 21:57:55.033 745251a8a080 Info: Loading actions file: /etc/privoxy/user.action
2025-05-09 21:57:55.033 745251a8a080 Connect: Initialized 100 socket slots.
2025-05-09 21:57:55.033 745251a8a080 Info: Listening on port 8118 on IP address 127.0.0.1
2025-05-09 21:57:55.033 745251a8a080 Info: Listening on port 8118 on IP address ::1
2025-05-09 21:57:55.033 745251a8a080 Connect: Waiting for the next client connection. Currently active threads: 0

I temporarily removed the cacher config from 50-config-updates and it worked again, so sys-apt-cacher-ng is the real issue here.

After posting this issue i found the solution myself:
Appending the following in acng.conf:
PassThroughPattern: ^dl\.flathub\.org:443$

I should buy a rubber duck

2 Likes

Great job! i had managed to fix this issue with your help.
for later readers, acng.conf exists in /etc/apt-cacher-ng/acng.conf.
so, first doing
qvm-run -u root <cachervmname> xterm , then
sudo vi /etc/apt-cacher-ng/acng.conf , then adding the
PassThroughPattern: ^dl\.flathub\.org:443$ in the arbitrary line without #, will make things work.

2 Likes

Some flatpaks will still fail because they require a gpg key which is not passed through.
… I can only think of specifying a passthrough for those gpg urls / keyservers as well

And some flatpaks need other URLs as well like spotify needs access to the snap store

Does it happen when using flathub.org only?

If you mean that only specifying this passthrough line:
PassThroughPattern: ^dl\.flathub\.org:443$
results in errors then yes.

I don’t use other flatpak repos