Ollama runs AI models on your own PC, but it still needs the internet to download them. On a work, school or other managed network, that traffic often has to go through a proxy server, and if Ollama doesn't know about it, ollama pull simply fails. The fix is a single environment variable, plus a certificate in some cases. This guide follows Ollama's own FAQ.
Before you start
You'll need three things:
The proxy address, for example https://proxy.example.com:8080. Your IT team or your system's network settings will have it.
Permission to use it for downloads. Model files are large, and some networks block or limit big downloads.
The proxy's certificate, if the proxy inspects encrypted traffic. Ollama's FAQ says the proxy certificate must be installed as a system certificate.
Proxy settings only affect Ollama's outbound downloads from the internet. Running a model you've already downloaded doesn't need the internet at all.
The one rule: use HTTPS_PROXY, not HTTP_PROXY
Ollama's FAQ says to use the HTTPS_PROXY environment variable to send outbound requests through the proxy. It also says to avoid setting HTTP_PROXY: Ollama doesn't use plain HTTP for model pulls, only HTTPS, and setting HTTP_PROXY may interrupt client connections to the Ollama server.
That second point is easy to miss if you're used to setting both variables. Ollama runs a local HTTP server that apps such as chat front ends connect to (by default on port 11434), and the FAQ warns that HTTP_PROXY may interrupt those client connections. If you already have HTTP_PROXY set for other software and apps can no longer talk to Ollama, that's the first thing to check.
Windows
On Windows, Ollama reads your user and system environment variables. Its FAQ gives these steps:
Quit Ollama by clicking its icon in the taskbar and choosing to quit.
Open Settings and search for environment variables, then choose Edit environment variables for your account.
Create a new variable called HTTPS_PROXY with your proxy address as the value, for example https://proxy.example.com:8080.
Click OK to save.
Start Ollama again from the Start menu.
Our guide to setting Ollama environment variables on Windows goes through this dialog step by step, plus the other variables Ollama reads.
Linux
If Ollama runs as a systemd service on Linux (see how to install Ollama on Linux), Ollama's FAQ says to add environment variables to the service:
Run sudo systemctl edit ollama.service. This opens an editor.
Under a [Service] section, add:
[Service]
Environment="HTTPS_PROXY=https://proxy.example.com:8080"
Save and exit, then reload systemd and restart Ollama:
sudo systemctl daemon-reload
sudo systemctl restart ollama
Setting the variable in your own terminal isn't enough here, because the Ollama service doesn't run in your terminal session.
macOS
If you use the Ollama Mac app, Ollama's FAQ says environment variables should be set with launchctl, then the app restarted:
launchctl setenv HTTPS_PROXY "https://proxy.example.com:8080"
Docker
If you run Ollama in a container (see how to run Ollama in Docker), the FAQ says you can pass the proxy when starting the container with -e HTTPS_PROXY=https://proxy.example.com. Alternatively, you can configure the Docker daemon itself to use a proxy, using Docker's own instructions for Docker Desktop or for the Docker daemon with systemd.
If your proxy uses a self-signed or company certificate, the container also needs to trust it. Ollama's FAQ says this may require building a new image with the certificate added. Its example uses a short Dockerfile:
FROM ollama/ollama
COPY my-ca.pem /usr/local/share/ca-certificates/my-ca.crt
RUN update-ca-certificates
Then build and run that image with the proxy set:
docker build -t ollama-with-ca .
docker run -d -e HTTPS_PROXY=https://my.proxy.example.com -p 11434:11434 ollama-with-ca
Replace my-ca.pem with your organisation's certificate file and the proxy address with your own.
Check that it works
Once Ollama has restarted, try downloading a small model with ollama pull followed by the model name. If the download starts, the proxy is working.
If it still fails:
Certificate errors can mean the proxy's certificate isn't installed as a trusted system certificate on that PC or in that container.
Apps can no longer reach Ollama after you change proxy settings: check that HTTP_PROXY isn't set, as described above.
Nothing changed at all: make sure you fully quit and restarted Ollama; Ollama's FAQ steps for every platform restart it after a variable is changed. On Linux, check the variable was added to the service rather than your shell.
For anything else, Ollama's server logs may show the error behind a failed download.
Don't confuse this with a reverse proxy
An outbound proxy, covered here, is about Ollama reaching the internet. A reverse proxy, such as Nginx placed in front of Ollama, is about other devices reaching Ollama. If what you actually want is to use Ollama from a laptop or phone on your home network, see our guide to sharing Ollama on a local network instead, and be careful about exposing Ollama's API beyond a network you trust.
Our verdict
To use Ollama behind a proxy, set HTTPS_PROXY to your proxy's address using the method for your system, make sure the proxy's certificate is trusted, and restart Ollama. Don't set HTTP_PROXY: Ollama only downloads models over HTTPS, and its FAQ warns that HTTP_PROXY may interrupt apps' connections to the Ollama server. In Docker, pass -e HTTPS_PROXY when starting the container and build an image with your certificate if the proxy uses its own.