Skip to content

Proxies for Developers: Setup & Config Guide

Code on a computer screen in a developer workspace
Photo via Pexels. Most developer proxy setup is configuration, not new software: a host, a port, and a few settings in the tools you already use.

A proxy for developers is a server that sits between your code and the internet, forwarding requests on your behalf so you can control which IP address a request comes from, route traffic through a corporate network, or reach an API that your browser alone cannot call. This guide covers how to choose a proxy type, set it up with environment variables and per-tool settings, keep credentials safe, and fix the errors that show up most often.

Code on a computer screen in a developer workspace
Photo via Pexels. Most developer proxy setup is configuration, not new software: a host, a port, and a few settings in the tools you already use.

What a Proxy Does in a Development Workflow

A proxy server receives a request from your machine or your code, forwards it to the destination under its own IP address, and returns the response. For a developer, that middle step solves several everyday problems. It lets a script or a build tool reach the internet from behind a corporate firewall, it lets an API client appear to come from a chosen country or network, and it gives you one place to inspect, log, or cache the traffic leaving your machine.

If you are new to the basic idea, start with our guide to what is a proxy. It explains the request flow and the difference between a forward proxy, which acts for the client, and a reverse proxy, which sits in front of a server. The types of proxies guide covers the main kinds you will meet as a developer: HTTP, HTTPS, SOCKS4, SOCKS5, datacenter, residential, and mobile proxies, and when each one fits.

Proxies show up in developer work in four places. First, the terminal, where curl, wget, and package managers need to reach registries through a proxy. Second, language tooling, where npm, pip, and Git each have their own proxy setting. Third, the browser, where a frontend app hits CORS limits and needs a proxy to reach an API. Fourth, the server, where a reverse proxy such as Nginx sits in front of your app. This guide covers the first two in depth, and points you to dedicated guides for the last two.

Choosing the Right Proxy Type

The proxy type decides what your traffic looks like to the destination, and picking the wrong one is the most common reason a setup fails. An HTTP proxy handles HTTP traffic and, with the CONNECT method, can tunnel HTTPS traffic too. A SOCKS5 proxy works at a lower level, so it can carry almost any TCP traffic, including traffic from tools that do not speak HTTP. When a tool offers a choice, SOCKS5 is the more flexible option, while an HTTP proxy is simpler to configure and easier to inspect.

Datacenter proxies come from servers in data centers. They are fast and cheap, and they are the easiest to spot, because their IP ranges belong to hosting providers.

A developer working on a laptop
Photo via Pexels. The proxy type decides what a destination sees, so match it to the job before you configure anything.

Residential proxies use IP addresses assigned to home internet connections, so they look like ordinary users, and they cost more. Mobile proxies route through 4G and 5G carrier networks, which makes them the hardest to tell apart from real users, and usually the most expensive. For local development and testing against your own services, a datacenter proxy or a local proxy on your own machine is enough. For work that touches third-party sites at volume, the choice matters more, and our guide to proxy types explains the trade-offs in full.

One rule applies whatever type you pick: use a proxy you control or a provider with a published privacy policy. A free proxy list found online can log your traffic, inject content, or disappear without warning, and it should never carry credentials, tokens, or customer data.

The Three Layers of Proxy Configuration

Developer proxy setup has three layers, and most confusion comes from setting one layer and expecting another to follow. The system layer sets a proxy for the operating system, and apps that respect system settings pick it up. The environment layer sets variables such as HTTP_PROXY and HTTPS_PROXY in your shell, which most command-line tools and many libraries read. The tool layer sets a proxy inside one program, such as npm or Git, which overrides the other layers for that program only.

Set the narrowest layer that does the job. If only npm needs a proxy, configure npm. If every command-line tool needs one, set the environment variables. If the whole machine needs one, use the system setting. Setting all three at once makes failures hard to trace, because a request can pass through two proxies before it reaches the internet.

A developer working on a laptop with code on the screen
Photo via Pexels. Configure only the tools that need the proxy, so a failure points to one place instead of three.

Environment Variables: HTTP_PROXY, HTTPS_PROXY, and NO_PROXY

Environment variables are the standard way to give command-line tools a shared proxy address. Most HTTP libraries, CLIs, and build tools read them, and they work the same way on macOS and Linux, with a slightly different syntax on Windows. The three variables you need are HTTP_PROXY for plain HTTP requests, HTTPS_PROXY for HTTPS requests, and NO_PROXY for hosts that should bypass the proxy entirely.

On macOS or Linux, a temporary setup for one terminal session looks like this:

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

The NO_PROXY list matters more than most guides admit. Local services, internal hostnames, and anything on localhost should bypass the proxy, or your own app will try to reach itself through an outside server and fail. Note the leading dot in .internal.example.com, which matches that domain and its subdomains.

Some tools read only the lowercase names (http_proxy, https_proxy), others read only the uppercase names, and curl is a known special case: it accepts http_proxy only in lowercase, because the uppercase HTTP_PROXY can be set by a web server from an incoming request header. The safe approach is to set both cases to the same value. For SOCKS proxies, use ALL_PROXY with a socks5:// URL, which applies when no protocol-specific variable is set. With curl, socks5h:// sends the hostname to the proxy for remote DNS resolution, while socks5:// resolves the name on your own machine first, which can leak the hostname you are visiting.

On Windows, the same idea uses set in Command Prompt or $env: in PowerShell, and the setting lasts only for that terminal session:

set HTTP_PROXY=http://proxy.example.com:8080
set HTTPS_PROXY=http://proxy.example.com:8080

To make the setting permanent, add the exports to your shell startup file, such as ~/.zshrc or ~/.bashrc, on macOS and Linux, or set a user environment variable on Windows. Never put a proxy password in a shared shell profile, a repository, or a build log. Use a secrets manager or a per-machine config file with restricted permissions instead.

Using curl and wget Through a Proxy

curl is the fastest way to confirm a proxy works, because it shows exactly what happens on the wire. The -x flag sets a proxy for one command, and it overrides any environment variable:

curl -x http://proxy.example.com:8080 https://httpbin.org/ip

If the proxy needs a username and password, pass them with --proxy-user so they do not sit in the URL:

curl -x http://proxy.example.com:8080 --proxy-user username:password https://httpbin.org/ip

The response from httpbin.org/ip shows the IP address the destination sees. If it matches your own IP, the proxy is not being used. If it matches the proxy address, the route works. Add -v to see the CONNECT request to the proxy, which is the fastest way to tell whether the failure is a connection problem, an authentication problem, or a problem at the destination. A 407 response means the proxy wants authentication. A 502 or 504 usually means the proxy reached the destination but the destination did not answer in time.

One detail catches people out: if you leave the port out of a curl proxy address, curl assumes port 1080, the SOCKS default, not 8080 or 3128. Always write the port. To force a direct connection when the environment says otherwise, pass an empty proxy with curl --proxy "" https://example.com.

wget reads the same environment variables, and it also accepts a proxy = line in ~/.wgetrc for a permanent per-user setting. Our guide to how to check if a proxy works walks through IP checks, header checks, and DNS leak checks you can run after any setup.

Authenticating to a Proxy

Corporate proxies almost always require credentials, and there are three ways to supply them. The simplest is to embed the username and password in the proxy URL, as in http://username:password@proxy.example.com:8080. This works almost everywhere, but the password is visible in shell history, process lists, and logs, so it is the least safe option. URL-encode special characters in the password: @ becomes %40 and : becomes %3a.

The safer option is the tool’s own credential flag, such as curl --proxy-user or the username and password fields in a browser or IDE proxy dialog. The safest option for a team is IP allowlisting, where the proxy provider accepts traffic from your office or server IP without a password at all. Chrome, for example, does not support SOCKS5 proxies that need a username and password, so IP allowlisting is the usual workaround there.

If a proxy returns a 407 response, it is asking for authentication, and the response headers name the method it wants. Basic authentication is the default in curl, and --proxy-anyauth lets curl pick from the methods the proxy offers. If authentication keeps failing, check that the password was URL-encoded.

Per-Tool Configuration: npm, pip, and Git

Package managers and version control each keep their own proxy setting, and they do not always read the environment variables. npm reads its own config first:

npm config set proxy http://proxy.example.com:8080
npm config set https-proxy http://proxy.example.com:8080

pip reads the environment variables, and it also accepts a --proxy flag per command. Git has its own setting, which you set once per machine:

git config --global http.proxy http://proxy.example.com:8080
git config --global https.proxy http://proxy.example.com:8080

Our guide to proxy settings for npm, pip and Git covers each tool in depth, including how to remove a setting when you leave a network that needs it, and the mistakes that leave a stale proxy in place for months. The short version is worth remembering: when a tool suddenly cannot reach the internet after a network change, check its own proxy setting before anything else, because environment variables and tool settings can disagree silently.

Docker and Containers Behind a Proxy

Docker is the tool most likely to ignore your terminal proxy setting, because the Docker daemon runs as a background service, not inside your shell. Setting HTTP_PROXY in your terminal changes nothing for image pulls. The daemon reads its own configuration, usually through a systemd drop-in file on Linux, and builds need proxy settings passed as build arguments.

For image pulls, configure the daemon with the proxy address and restart it. For builds, pass the proxy as a build argument so the steps inside the Dockerfile can reach the internet:

docker build --build-arg HTTP_PROXY=http://proxy.example.com:8080 --build-arg HTTPS_PROXY=http://proxy.example.com:8080 .

Containers that run your app need the proxy too, either through environment variables in the container or through a proxy-aware base image.

Code on a monitor in a developer workspace
Photo via Pexels. Keep proxy settings out of images and pass them at run time, so the same image works on any network.

A common mistake is to bake a corporate proxy address into an image and then ship that image to a different network, where the address does not exist. Keep proxy settings out of images and pass them at run time.

Browser Proxies and Developer Tools

Frontend work brings its own proxy problems. A browser follows the system proxy setting on most platforms, while Firefox keeps its own proxy settings and supports SOCKS5 with a username and password without any extension. For per-site rules and quick switching, a proxy manager extension such as FoxyProxy or ZeroOmega holds several proxy profiles and switches between them based on the site you visit.

The most common browser-side proxy problem is CORS, where a frontend app on one origin cannot read responses from an API on another origin because the API sends no CORS headers. A CORS proxy fetches the response server-side and returns it with the headers the browser needs. It is a development shortcut, not a production design: the proper fix is to configure CORS on the API or route the call through your own backend.

Reverse Proxies in Front of Your App

A reverse proxy sits in front of your application servers and takes requests from visitors before they reach your code. Nginx is the usual choice, and the core of the setup is one directive, proxy_pass, which tells Nginx where to forward a request. Our Nginx reverse proxy guide walks through the full setup, including headers, WebSockets, load balancing, and HTTPS with Let’s Encrypt.

The two proxy directions are easy to confuse, and the confusion causes real bugs. A forward proxy acts for the client and hides the client from the server. A reverse proxy acts for the server and hides the server from the client.

Running Your Own Proxy Server

Sometimes the right answer is to run the proxy yourself instead of renting one. A small VPS with a proxy server gives you a fixed IP, full logs, and no shared users, and it is the only way to be sure nobody else sees your traffic. Our guide to how to create your own proxy server covers the options, and our guide to how to set up a proxy server covers the server side in more detail.

Self-hosting has costs that rented proxies do not. You maintain the server, patch it, watch its logs, and fix it when it goes down. For a single developer testing against a fixed IP, self-hosting is reasonable. For a team, or for traffic that needs many IPs, a provider is usually the better trade.

A developer working at a desk with a laptop and notebook
Photo via Pexels. A self-hosted proxy gives you full control, but you also own the maintenance.

Corporate Proxies, Certificates, and TLS

A corporate proxy often decrypts HTTPS traffic so it can inspect it, which means your tools will see a certificate signed by the company certificate authority instead of the public one. When that happens, curl, Python, and Node will refuse the connection with a certificate error, because the company authority is not in their trust store. The fix is to add the company root certificate to the tool’s trust store, not to disable verification. Disabling verification with flags such as curl -k or Node NODE_TLS_REJECT_UNAUTHORIZED=0 removes the protection that TLS provides, and it should never be a permanent setting.

Keeping Proxy Credentials Safe

Proxy credentials are secrets, and they leak through the same channels as any other secret. Shell history records commands with passwords in the URL. CI logs print environment variables. Dockerfiles bake values into image layers. A few habits prevent most leaks: use a password manager or a secrets store for proxy credentials, pass them through environment variables set by the CI system rather than written in files, and rotate them when someone leaves the team.

Never commit a proxy password to Git, even in a private repository. Git history keeps the password after you delete the line, and private repositories are shared more widely than people expect. If a password has been committed, rotate it and treat it as exposed.

Troubleshooting the Most Common Failures

Most proxy failures fall into a small set of causes, and checking them in order saves time. First, confirm the proxy address and port are right, and that the proxy server is reachable, with a simple curl command and the -v flag. Second, check authentication: a 407 means the proxy wants credentials, and a 403 from the proxy means the credentials were rejected or the destination is blocked. Third, check the bypass list: a request to localhost or an internal host that goes through the proxy will fail, and NO_PROXY is usually the fix. Fourth, check for a stale setting. A proxy configured in npm, Git, or a shell startup file stays in place after you change networks, and it will break tools that no longer need it. Fifth, check for a certificate error, which points to TLS inspection and a missing company certificate. Sixth, check for two proxies stacked on each other: a system proxy plus an environment variable plus a tool setting can send a request through the proxy twice.

Our guide to corporate proxy errors and fixes covers the error codes in detail, including 407, 502, 503, and connection timeouts, with the fix for each one.

Developers working together at a desk with laptops
Photo via Pexels. When a proxy fails, check the address, the credentials, and the bypass list before changing anything else.

A Practical Setup Checklist

A clean developer proxy setup can be described in a few lines. Pick the proxy type that fits the job, and use a provider you trust or a server you control. Set the proxy at the narrowest layer that works, and set both uppercase and lowercase environment variables. Add localhost, 127.0.0.1, and internal domains to NO_PROXY. Verify the route with curl against an IP echo service, and confirm the address shown is the proxy address. Store credentials outside the repository, and document the setup in the project readme, so the next developer does not have to rediscover it.

Frequently Asked Questions

How do I set a proxy for development work?

Set the HTTP_PROXY and HTTPS_PROXY environment variables in your shell, and add localhost and internal domains to NO_PROXY. Tools that keep their own setting, such as npm and Git, need their own configuration as well.

What is the difference between HTTP_PROXY and HTTPS_PROXY?

HTTP_PROXY applies to plain HTTP requests, and HTTPS_PROXY applies to HTTPS requests. Set both to the same proxy address in most setups, and remember that curl reads http_proxy only in lowercase.

Should I use an HTTP proxy or a SOCKS5 proxy?

Use an HTTP proxy for web traffic and simple setups. Use SOCKS5 when a tool needs to carry non-HTTP traffic, or when you need remote DNS resolution through the proxy with the socks5h:// scheme.

Why does curl work but npm fail through the same proxy?

npm keeps its own proxy setting and does not always read the environment variables. Run npm config get proxy and npm config get https-proxy to see what npm is using, and set them to match.

Why does Docker ignore my terminal proxy settings?

The Docker daemon runs as a background service outside your shell, so it never sees your terminal variables. Configure the daemon itself for image pulls, and pass proxy build arguments for builds.

How do I stop a proxy password appearing in shell history?

Use the tool’s credential flag, such as curl --proxy-user, instead of putting the password in the URL. For permanent setups, store credentials in a secrets manager and pass them through CI variables.

What should go in NO_PROXY?

Local addresses such as localhost and 127.0.0.1, internal domains, and any service that runs on your own machine. Without these entries, local requests are sent to the outside proxy and fail.

Is it safe to use a free proxy for development?

No, not for anything that carries credentials, tokens, or customer data. A free proxy operator can log traffic, and free proxies disappear without warning. Use a provider with a published privacy policy or a server you control.

Sources

10

Every factual claim on this page was verified against a named source above. Proxy commands and environment variable behaviour were checked on 23 November 2026; check the linked documentation for current details.

Priya Nair

Written by

Priya Nair Proxy Guides Writer

Priya's byline covers proxy setup guides and proxy error troubleshooting. Steps follow the official documentation of the browser, tool or operating system involved, with the version noted. Guides start from the error message or setting the reader is looking at and work towards the fix.

How our articles are researched, reviewed and updated