Ollama Proxy Setup: HTTPS_PROXY on Every Platform
Configure Ollama behind a proxy with HTTPS_PROXY on Linux, macOS, Windows, and Docker, with practical checks for authentication, TLS certificates, and failures.

How to Run Ollama Behind a Proxy on Any Platform
On a corporate network - or on a server with no direct internet access - Ollama can seem to work normally, right up until you try to download a model. ollama pull might hang or fail, and setting http_proxy in your terminal often changes nothing.
The catch is easy to miss: the command-line tool usually doesn't do the downloading. The Ollama server does, and it may be running as a background service with a different environment than your shell.
The reliable fix is to configure the proxy where the server runs. In most setups that means setting HTTPS_PROXY, restarting Ollama, and checking the server logs. This guide walks through the client/server split, shows how to apply the settings on Linux (systemd), macOS, Windows, and Docker, and covers proxy authentication, corporate TLS certificates, and common failure modes. The goal isn't just "make one pull work" - it's a setup you can diagnose and maintain.
Why Ollama ignores a proxy set in your terminal
Ollama runs as a client-server system. The ollama command you type is the client. It sends requests to an Ollama server (typically 127.0.0.1:11434). When you run ollama pull or ollama run, the server is the one that fetches the model data from the internet.
Once you see that split, the rest is pretty straightforward: proxy settings must be applied to the server process, not just your interactive shell. Exporting a variable in a shell only changes that shell's environment and programs started from it. It usually won't affect a server already started by systemd, a desktop app, or Docker. The client can still reach the local server - while the server itself has no route through your company proxy.
Identify the process that downloads the model
Before changing anything, figure out how the Ollama server is running:
- On Linux, it's often the
ollama.servicesystemd unit. - On macOS or Windows, it might be the Ollama desktop app running in the background.
- In a container deployment, it's the process inside the Ollama container.
- If you started
ollama servemanually, that process inherits the environment from the terminal you launched it from.
A quick way to confirm the problem is server-side: stop the existing server, start it again in a terminal where the proxy variable is set, and then try a model pull. If that works, you've confirmed it's the server's environment - not the ollama client command.
Why this distinction matters operationally
What works in your interactive shell can break after a reboot, when the service manager restarts Ollama without your shell environment. You'll also see it in deployment automation: configuring a developer's workstation doesn't automatically configure a container or a service running under a different user/account.
So treat proxy settings as part of the Ollama server's runtime configuration. That keeps things reproducible and makes restarts predictable. It also helps you avoid mixing up two different concepts: an outbound proxy for model downloads is not the same thing as a reverse proxy used to expose Ollama's API to other machines.
Which proxy variable should you configure
For outbound model downloads, configure HTTPS_PROXY. Ollama downloads models over HTTPS, and using HTTPS_PROXY is typically the right choice. HTTP_PROXY can interfere with local client-to-server behavior, because not all proxy logic treats local traffic the way you'd expect.
A typical value looks like this:
HTTPS_PROXY=http://proxy.example.com:3128
The http:// part describes the connection from Ollama to the proxy. Even when the final destination is HTTPS, it's normal for the connection to the proxy to use plain HTTP; the proxy can then establish an HTTPS tunnel to the destination. Use the hostname and port your network admin gave you.
Test with a manually started server
To diagnose quickly, stop the background Ollama server and start a new one in a terminal with the proxy variable set:
HTTPS_PROXY=http://proxy.example.com:3128 ollama serve
In a second terminal, try:
ollama pull llama3.2
If this works, move the setting into whatever launches your usual server. If it doesn't, double-check the proxy address, whether authentication is required, and whether the machine trusts your network's TLS setup.
Ollama is written in Go, and its proxy handling accepts a complete proxy URL or a host/port. If you omit the scheme, it assumes http. It also reads lowercase variants like https_proxy, and those can take precedence over uppercase forms. To avoid "which one did it actually use?" problems, set a single intended variable and don't define conflicting uppercase and lowercase versions.
Keep local traffic local
Loopback addresses like localhost and 127.0.0.1 shouldn't go through the proxy. That's what you want: the ollama client should talk to the local server directly, while the server uses the proxy for outbound downloads.
If you customized NO_PROXY, review it to make sure it doesn't cause unexpected routing in your environment.
How to configure Ollama on each platform
The idea is the same everywhere: set HTTPS_PROXY in the environment inherited by the Ollama server process, then restart the server. Exporting a variable in a terminal is useful for testing, but services, desktop apps, and containers need their own persistent settings.
Linux with systemd
If Ollama is managed by systemd, you can use a service override. Create or edit one with:
sudo systemctl edit ollama.service
Add this under the [Service] section:
[Service]
Environment="HTTPS_PROXY=http://proxy.example.com:3128"
Reload systemd and restart:
sudo systemctl daemon-reload
sudo systemctl restart ollama
Overriding the unit file is better than editing the vendor-provided file directly. Updates can replace the original unit, while a systemd override is meant for local changes. After restarting, check the service logs to confirm the process came up with the expected environment.
If your proxy needs a username and password, you can use an authenticated URL like http://username:password@proxy.example.com:3128. Treat it like a secret. Service files can be readable by administrators, and environment variables may be visible through inspection tools. Use a dedicated proxy account with limited permissions rather than a personal one.
macOS with the Ollama application
If Ollama is running as a macOS desktop application, set the environment variable using launchctl:
launchctl setenv HTTPS_PROXY "http://proxy.example.com:3128"
Then fully quit and restart Ollama. Changing the variable won't magically update an app that's already running. If downloads still fail, make sure you truly restarted the application and that it picked up the environment in the launch context.
Windows desktop app
On Windows, the Ollama desktop app inherits environment variables from the user or system environment. Add HTTPS_PROXY in the environment-variable settings using the proxy URL as the value.
On Windows 11, search Settings for "environment variables". On Windows 10, use the Control Panel option.
After saving the change, quit Ollama from the system tray and launch it again from the Start menu. Existing processes keep the environment they started with, so opening a new terminal alone won't help if the desktop server is still running. Prefer a user-level variable unless you need it for all accounts on the machine.
Docker
When you start the Ollama container, pass the variable into the container:
docker run -d \
-e HTTPS_PROXY=http://proxy.example.com:3128 \
-p 11434:11434 \
--name ollama \
ollama/ollama
This sets up the environment for the Ollama process inside the container. Proxy settings for the Docker daemon or Docker Desktop are separate - they affect Docker's own operations (like pulling images), and they don't automatically become environment variables inside containers. If Ollama needs the proxy for model downloads, pass HTTPS_PROXY into the container or set it explicitly in your container definition.
For Compose or another orchestrator, put the setting in the service definition so it survives container recreation. Be careful with authenticated proxy URLs - don't commit credentials to a repository, and use your platform's secret mechanism when available.
How to handle authentication and corporate certificates
Some proxies require credentials. The common URL format is:
http://username:password@proxy.example.com:3128
It's simple, but the risks aren't. A password embedded in a command can linger in shell history. A value in a service file may be readable by other administrators. Container configuration can also be visible depending on who has access to the Docker control plane. Prefer a dedicated, narrowly scoped account and use the secret-management mechanism your environment provides.
If the username or password includes reserved URL characters, encode them correctly so they don't break the URL structure. Also, don't immediately assume the model endpoint is down when authentication fails. A proxy response like HTTP 407 usually means the proxy requires credentials or rejected the ones you provided.
Corporate TLS inspection
Some enterprise networks intercept HTTPS traffic by terminating the connection and issuing a replacement certificate from an organization-controlled certificate authority. In that scenario, HTTPS_PROXY might be set correctly, but downloads still fail because the Ollama server doesn't trust the inspecting certificate.
Fix it by installing the organization's approved root certificate into the trust store used by the Ollama process. Follow your IT team's certificate deployment process - don't disable certificate verification just to get it working. Disabling verification reduces protection against interception and can make things less secure overall.
Add the certificate to a Docker image
A container has its own filesystem and trust store. Installing a certificate on the Docker host doesn't automatically install it inside the Ollama container.
One approach is to build a derived image that adds the approved CA certificate:
FROM ollama/ollama
COPY my-ca.pem /usr/local/share/ca-certificates/my-ca.crt
RUN update-ca-certificates
Then build and run the image with the proxy environment variable:
docker build -t ollama-with-ca .
docker run -d \
-e HTTPS_PROXY=http://proxy.example.com:3128 \
-p 11434:11434 \
--name ollama \
ollama-with-ca
Use a certificate provided by your organization and keep the derived image as part of your deployment. If the certificate changes, rebuild and redeploy the image. It's more work than "tweak a running container," but it makes trust configuration reproducible.
How to verify and troubleshoot the connection
Start by confirming the server received the setting - not just the client. Ollama startup logs include a server config line listing configuration values, including proxy-related variables. Look for HTTPS_PROXY and, if relevant, NO_PROXY. This is often the fastest way to catch "set it in the wrong place" errors or "you didn't restart the server" issues.
Use the log location for the platform running the server:
- Linux with systemd:
journalctl -u ollama --no-pager --follow --pager-end - macOS:
cat ~/.ollama/logs/server.log - Docker:
docker logs ollama - Windows: open
%LOCALAPPDATA%\Ollama\server.log
Be careful about where you share logs or environment dumps. Don't post credentials or sensitive configuration values publicly. A proxy URL can include a username and password, and diagnostic output should be treated as sensitive.
Test the proxy independently
If the server logs show the expected proxy variable but pull still fails, test proxy connectivity separately with a tool like curl:
curl -v -x http://proxy.example.com:3128 https://ollama.com
This checks whether the machine can reach the proxy and connect to the destination through it. It doesn't guarantee every Ollama model download will work, but it helps separate basic proxy connectivity problems from Ollama-specific configuration issues.
Use the result to narrow things down:
- HTTP 407: missing/incorrect credentials or the proxy rejected what you sent.
- Certificate or TLS error: indicates TLS inspection and/or trust-store problems on the server side.
- Connection timeout or refusal: proxy host/port is unreachable, or firewall rules block the connection.
- No proxy variable in the server log: configure the service/app/container environment and restart the server.
- Client can't reach the local server: troubleshoot the local Ollama service separately; outbound proxy settings won't fix a broken local connection.
One common confusion is the phrase "use Ollama behind a proxy." People mean different things:
- An outbound proxy lets the Ollama server reach the internet to download models.
- A reverse proxy (for example, Nginx) sits in front of Ollama to expose its API to other machines.
Those are different problems, so the configuration differs.
Conclusion
Once you identify the process that actually downloads the model, the fix is pretty simple: set HTTPS_PROXY in the Ollama server's environment and restart it. On Linux, use a systemd override; on macOS, use launchctl for the app; on Windows, set environment variables for the desktop app; and in Docker, pass the environment variable into the container.
If downloads still fail, verify the server's startup configuration, test the proxy separately, and separate authentication issues from certificate trust problems. Keep credentials out of public logs and repositories, and treat corporate CA certificates as part of your deployment rather than a one-off change on a single machine.