env.dev

HTTP_PROXY

Specifies the proxy server URL for HTTP requests. Used by many command-line tools (curl, wget, apt), package managers (npm, pip), and programming language HTTP clients. The format is typically http://[user:password@]host:port.

Last updated:

HTTP_PROXY points outbound HTTP traffic through a proxy server, in the form http://[user:password@]host:port. It is a de-facto convention rather than a standard, honored by curl, wget, apt, pip, and most language HTTP stacks — but adoption is uneven, which is the whole problem. Pair it with HTTPS_PROXY (for TLS traffic) and NO_PROXY (for exceptions); setting only HTTP_PROXY rarely does what people expect, because most traffic today is HTTPS and ignores it. Both lowercase (http_proxy) and uppercase forms exist, and not every tool reads both.

Provider
General / OS
Category
network
Set by
Set manually or via corporate network configuration
Example
http://proxy.example.com:8080
Gotcha: There is a real security wrinkle: because some CGI environments expose the 'Proxy:' request header as HTTP_PROXY, the curl/libcurl ecosystem deliberately ignores the uppercase HTTP_PROXY in CGI contexts (the 2016 'httpoxy' CVE). For HTTP traffic, prefer lowercase http_proxy. And remember the credentials in the URL are sent in plaintext to the proxy.

How to set HTTP_PROXY

bash (set the trio together)

export HTTP_PROXY=http://proxy.example.com:8080
export HTTPS_PROXY=$HTTP_PROXY
export NO_PROXY=localhost,127.0.0.1,.internal

Docker build args

docker build \
  --build-arg HTTP_PROXY=http://proxy:8080 \
  --build-arg HTTPS_PROXY=http://proxy:8080 -t myapp .

Frequently Asked Questions

Should I set http_proxy lowercase or HTTP_PROXY uppercase?

Set both to be safe, but prefer lowercase for HTTP traffic: due to the 2016 httpoxy vulnerability, curl and libcurl-based tools ignore the uppercase HTTP_PROXY when running in a CGI context to avoid being hijacked by a client-supplied Proxy header. HTTPS_PROXY and NO_PROXY do not have this caveat.

Was this helpful?

Stay up to date

Get notified about new guides, tools, and cheatsheets.

Browse all 242 environment variables →