Test your approved proxy with one apt-get update before changing the machine’s APT configuration. The command refreshes package indexes; it does not install or upgrade packages. Ubuntu and Debian use the same APT configuration keys here. The test described below ran on Ubuntu; the syntax is also documented by Debian.
Use an APT proxy for one update
Set MEXELA_APT_PROXY to the approved proxy URL, including its scheme and port, without embedding a password in the command. Run in a shell already authorized to refresh APT indexes. Your administrator may require elevation on a normal Ubuntu or Debian installation; follow local policy rather than copying the example into a root profile.
: "${MEXELA_APT_PROXY:?Set the approved proxy URL first}"
apt-get -o Acquire::http::Proxy="$MEXELA_APT_PROXY" \
-o Acquire::https::Proxy="$MEXELA_APT_PROXY" \
-o APT::Update::Error-Mode=any update
The configuration keys name the repository transport. An HTTPS repository can use an approved proxy whose URL starts with http://; that URL describes how APT connects to the proxy. The example uses strict update error handling so a partial failure is not mistaken for a clean refresh.
Make the setting persistent only if the proxy is standard
If the proxy is required by policy, ask the administrator to place these two lines in a dedicated APT fragment such as /etc/apt/apt.conf.d/80local-proxy, preserving existing settings. Replace the template host and port. Debian’s APT transport documentation covers host-specific rules and the separate authentication file; do not put credentials in a shared configuration fragment.
Acquire::http::Proxy "http://proxy.example.com:3128/";
Acquire::https::Proxy "http://proxy.example.com:3128/";
To verify that APT reads the fragment, run without the two command-line proxy overrides:
apt-get -o APT::Update::Error-Mode=any update
Read the error before changing repositories
| Observation | Next check |
|---|---|
| 407 Proxy Authentication Required | Confirm the approved proxy account and method. |
| 404 or no Release file | Check the repository URL, suite and mirror. A proxy may have carried the request correctly. |
| Certificate or repository-signature failure | Check the approved CA, repository signing key and system time. Keep TLS and repository signature verification enabled. |
If APT works on the host but fails in a container build, inspect the build’s own proxy configuration. The Docker proxy guide separates the build, daemon and container. See the developer integration hub for other package managers and clients.
Verification, December 5, 2026: The transient command and persistent fragment were run with the real APT client on Ubuntu and a disposable signed repository through a loopback proxy. A changed signature and an HTTP 407 were each rejected. No packages were installed, and no public repository was contacted.
What if only one APT repository fails?
Identify the repository hostname and its HTTP or HTTPS scheme in the failed update. Check your APT configuration for that exact host as well as the default proxy settings. A host-specific rule can select a different proxy or an approved direct connection, so a successful update from another mirror cannot establish the route to this one. If the mirror redirects, record the final hostname too.
Inspect the configuration locally with apt-config dump in the same execution environment. Its output can contain internal addresses or credentials, so share only the relevant key names, a redacted host label, and the error. Leave any intentional exceptions with their owner. See the Debian APT transport reference for host-specific settings.
