How to fix E: Acquire::http::Proxy URL is invalid in APT

APTINTERMEDIATEMEDIUMUpdated Dec 29, 2025· 185 views

This error occurs when your apt proxy configuration contains a malformed URL that does not follow the required URI format. APT proxy URLs must include a valid scheme (http, https, or socks5h), proper host and port formatting, and correct syntax. Fix this by checking your proxy configuration files and correcting the URL format.

Quick fix

Fixes E: Acquire::http::Proxy URL is invalid

sudo grep -r "Acquire::.*Proxy" /etc/apt/apt.conf.d/
  1. Check proxy configuration files
  2. Verify proxy URL format
  3. Handle special characters in passwords
  4. Edit proxy configuration files
apt — error
sudo grep -r "Acquire::.*Proxy" /etc/apt/apt.conf.d/
E: Acquire::http::Proxy URL is invalid

What this error means

The apt package manager validates proxy URLs against a strict format specification. The required format is scheme://[[user][:pass]@]host[:port]/ where scheme must be http, https, or socks5h. If your configuration has missing colons, incorrect slashes, invalid characters, unescaped special characters in passwords, or missing the required scheme prefix, apt will reject it as invalid. This validation ensures apt can properly parse and use the proxy settings without attempting invalid network connections.

Typical symptoms

  • apt update, apt install, or apt upgrade fails with "URL is invalid" error
  • Error mentions Acquire::http::Proxy or Acquire::https::Proxy configuration
  • Commands work fine without proxy but fail with proxy enabled
  • Configuration file edits resulted in this error appearing after reload

Common causes

  1. Proxy URL missing the scheme prefix (http://, https://, or socks5h://)
  2. Incorrect host:port separator or missing port number entirely
  3. Special characters in password not properly URL-encoded or escaped
  4. Typo in configuration (using underscore in "Acquire_http" instead of double colon)
  5. Missing quotes around the URL value in configuration file
  6. Missing semicolon at the end of the configuration line
  7. Invalid characters in hostname or port that are not allowed in URIs

How to fix "E: Acquire::http::Proxy URL is invalid"

1Check proxy configuration files

APT proxy settings are stored in configuration files under /etc/apt/apt.conf.d/. Search for any proxy-related configuration:

bash
sudo grep -r "Acquire::.*Proxy" /etc/apt/apt.conf.d/

Also check the main configuration file:

bash
sudo grep -r "Acquire::.*Proxy" /etc/apt/apt.conf

This will show you all lines where proxy settings are defined. Note the file names and line numbers where these appear.

2Verify proxy URL format

The correct format for a proxy URL in apt configuration is:

bash
scheme://[[user][:pass]@]host[:port]/

Valid examples:

bash
Acquire::http::Proxy "http://proxy.example.com:8080/";
Acquire::https::Proxy "https://proxy.example.com:8443/";
Acquire::http::Proxy "http://username:password@proxy.example.com:8080/";
Acquire::http::Proxy "socks5h://127.0.0.1:1080/";

Common mistakes to avoid:
- Missing "http://" or other scheme prefix
- Using "http:/proxy" instead of "http://proxy" (missing one slash)
- Writing "Acquire_http" instead of "Acquire::http"
- Forgetting the trailing slash after the port
- Missing quotes around the URL
- Missing the semicolon at the end

3Handle special characters in passwords

If your proxy password contains special characters like @ # % & = +, they must be URL-encoded:

bash
# Example: password is "p@ss=word#123"
# URL-encode: p%40ss%3Dword%23123

Acquire::http::Proxy "http://username:p%40ss%3Dword%23123@proxy.example.com:8080/";

Common URL encodings:
- @ becomes %40
- # becomes %23
- % becomes %25
- & becomes %26
- = becomes %3D
- : becomes %3A (only encode in password, not in scheme://)

To safely encode your password, use this command:

bash
echo -n "your-password" | jq -sRr @uri
4Edit proxy configuration files

Open your proxy configuration file with a text editor:

bash
sudo nano /etc/apt/apt.conf.d/70debconf

Or create a new proxy-specific file:

bash
sudo nano /etc/apt/apt.conf.d/proxy.conf

Update the proxy lines with correct formatting. Example valid configuration:

bash
Acquire::http::Proxy "http://192.168.1.100:3128/";
Acquire::https::Proxy "https://192.168.1.100:3128/";
Acquire::ftp::Proxy "ftp://192.168.1.100:3128/";

Make sure each line:
1. Uses correct scheme (http://, https://, socks5h://)
2. Has proper host:port separator
3. Ends with a trailing slash
4. Has quotes around the entire URL
5. Ends with a semicolon

Save the file (Ctrl+O, Enter, Ctrl+X in nano).

5Test the proxy configuration

After fixing the configuration, test if apt accepts it:

bash
sudo apt update

If you still see "URL is invalid", check the exact error message for which line has the problem:

bash
sudo apt -o Debug::Acquire::http=true update 2>&1 | grep -i proxy

If the error persists, verify syntax by checking what apt loaded:

bash
sudo apt-config dump | grep -i proxy

This shows exactly how apt parsed your configuration. Compare it to your intended proxy URL.

6Disable proxy if problems continue

If you cannot get the proxy working, you can temporarily disable it to resume normal apt operations:

bash
sudo nano /etc/apt/apt.conf.d/proxy.conf

Comment out or delete the proxy lines:

bash
# Acquire::http::Proxy "http://proxy:8080/";
# Acquire::https::Proxy "https://proxy:8080/";

Or use the special value DIRECT to disable proxy:

bash
Acquire::http::Proxy "DIRECT";
Acquire::https::Proxy "DIRECT";

Save and test:

bash
sudo apt update

Advanced notes

APT supports multiple proxy schemes: http and https are the most common, while socks5h provides SOCKS5 proxy with remote DNS resolution (socks5h means DNS queries go through the proxy, useful behind strict firewalls). The environment variables http_proxy, https_proxy, and ftp_proxy are ignored by apt—you must use the /etc/apt/apt.conf.d/ configuration files. For authentication proxies, many corporate proxies require NTLM authentication which standard HTTP proxy settings cannot handle; in those cases, consider using a proxy cache like apt-cacher-ng or squid with pass-through authentication. If you see this error in a container or CI/CD pipeline, remember that apt configuration must be set during image build time, not at runtime, and ensure all required proxy settings are in place before running apt commands. Some systems use /etc/environment or ~/.bashrc for http_proxy, but apt ignores these in favor of its own configuration files.

Frequently asked questions

What does "E: Acquire::http::Proxy URL is invalid" mean?
The apt package manager validates proxy URLs against a strict format specification. The required format is scheme://[[user][:pass]@]host[:port]/ where scheme must be http, https, or socks5h. If your configuration has missing colons, incorrect slashes, invalid characters, unescaped special characters in passwords, or missing the required scheme prefix, apt will reject it as invalid.
How do I fix "E: Acquire::http::Proxy URL is invalid"?
This error occurs when your apt proxy configuration contains a malformed URL that does not follow the required URI format. APT proxy URLs must include a valid scheme (http, https, or socks5h), proper host and port formatting, and correct syntax. Fix this by checking your proxy configuration files and correcting the URL format.
What causes "E: Acquire::http::Proxy URL is invalid"?
Proxy URL missing the scheme prefix (http://, https://, or socks5h://) Incorrect host:port separator or missing port number entirely Special characters in password not properly URL-encoded or escaped
Is the "E: Acquire::http::Proxy URL is invalid" error serious?
It is a medium-severity error — more of a blocker than a risk. The steps above resolve it.

Official resources & further reading