Running Ollama behind a corporate proxy

Ollama pulls models over HTTPS, so a corporate proxy with TLS inspection needs the right proxy variables and CA trust at each layer. This page explains how to configure them and what to verify.

On this page

Why Ollama pulls fail behind a corporate proxy and when to fix it

A shared Ollama host or container cannot download models when all outbound traffic must pass through a corporate proxy. The failure usually shows up as a timeout or a refused connection during ollama pull, because the Ollama server makes its own outbound HTTPS calls to fetch model manifests and layers. Those calls do not follow the proxy settings of the engineer's laptop or of a browser. The server process needs its own proxy configuration, and the team that runs it needs to know which traffic is meant to leave the network. Two paths are involved. Model pulls and direct cloud calls to ollama.com leave the host and should go through the proxy. The local API on 127.0.0.1:11434 is a separate path between the host and its own clients, and it should not be routed through the proxy at all.

Teams usually need this work in three situations: the network allows outbound access only through a proxy, the proxy performs TLS inspection and re-signs certificates with an internal authority, or the proxy permits only an allow-listed set of domains. Each one changes what has to be configured. TLS inspection adds a CA certificate that the Ollama host must trust. An allow-list means someone must confirm which hostnames the model registry and any cloud endpoints resolve to, and whether the proxy is willing to pass them. Confirm with your network or security team how the proxy product handles HTTPS tunnels, authentication, exceptions for internal addresses and logging, because the exact behavior depends on your proxy product and policy, and this page cannot predict it for your environment.

Proxy settings by where Ollama runs

This table compares the four places proxy configuration can live for Ollama: the Linux systemd service, a workstation install, a container run and the Docker daemon. For each one, it shows what the setting affects and the main risk, so you can check the right layer before a model pull or image pull fails. Confirm exact variable names against the current Ollama documentation before rollout.

Where Ollama runsSetting location and what it affectsMain risk
Linux host serviceSystemd environment override for the ollama service. Affects model pulls made by the server process, not the shell user's commands.Variables set in a login shell do not reach the service, so pulls work by hand but fail under systemd.
Workstation installUser environment or the desktop app's settings, depending on the OS. Affects model pulls and any client traffic from that user's session.Settings can be lost on app restart or update, and each user may configure a different proxy.
Container runEnvironment variables passed to the container at start. Affects model pulls made inside the container only.Values baked into a fixed run command get stale when the proxy address or CA changes.
Docker daemonDaemon proxy configuration used when Docker fetches base and Ollama images. Affects image pulls, not model pulls.A daemon restart is needed after changes, and a missing change blocks image pulls while model pulls still work.
Proxy CA certificateTrust store on the host or in the container image. Affects every HTTPS pull that passes through a TLS-inspecting proxy.Without the proxy's CA, pulls fail with certificate errors, and a CA baked into an image must be rebuilt when it rotates.
NO_PROXY exclusionsHosts that bypass the proxy, set at the same layer as the proxy. Affects local and internal endpoints such as localhost on port 11434.Local API clients sent through the proxy break, a classic symptom of HTTP_PROXY being applied too broadly.

Why HTTP_PROXY alone breaks client connections

Setting only HTTP_PROXY is a common mistake because most of the traffic Ollama handles to pull models and reach its registry runs over HTTPS. For HTTPS, a client asks the proxy to open a CONNECT tunnel, and the proxy cannot inspect or rewrite the encrypted payload unless it terminates TLS on purpose. That means HTTPS_PROXY must be set for the process that makes the pull, and the proxy's certificate authority must be trusted by that client, or the TLS handshake fails with a certificate error that looks unrelated to the proxy. Teams often see a pull fail, add a proxy variable for HTTP, and conclude the proxy is at fault when the real gap is the HTTPS path and the trust chain. Confirm with your security team whether your proxy intercepts TLS, and which CA bundle the Ollama host or container should trust, before you change anything.

The second failure is the opposite problem. A proxy variable applied too broadly sends local traffic through the corporate proxy as well. The Ollama API listens on 127.0.0.1:11434 by default, and a client on the same host that calls localhost or 127.0.0.1 can end up routed to the proxy, which cannot reach the loopback address and returns an error or a gateway page. Set NO_PROXY to exclude localhost, 127.0.0.1, ::1, and any internal hostnames, service names and private address ranges your organization uses for internal services. The exact syntax that each client library and runtime accepts varies, so confirm the matching rules in your own environment rather than assuming a wildcard form works everywhere.

Test the change in two steps. First, pull a small model through the proxy and confirm the download completes from the host or container where the Ollama service runs. Second, send a request to the local API, for example a model listing or a short generate call against from the same shell or service context that the applications use. If the local call fails while the pull succeeds, the proxy is still capturing loopback traffic and NO_PROXY` needs another entry. Record which variables were set, at which level (shell, systemd unit, container environment), and which CA bundle was used, so the next person can reproduce the working configuration.

How a model pull travels from the client to the public registry

The client, whether an SDK, the CLI or a browser tool, calls the Ollama API on 127.0.0.1:11434. That local leg does not go through the proxy. The Ollama server then makes its own outbound HTTPS request for the model, and HTTPS_PROXY decides whether that request goes to the corporate proxy. Hosts listed in NO_PROXY skip the proxy. Where the proxy inspects TLS, the server must trust the proxy's internal CA, so check that trust point first when pulls fail with certificate errors.

Local API calls skip the proxy; model pulls leave the host through it.

How to configure Ollama proxy settings and CA trust in order

This sequence takes an Ollama host from an unconfigured state to one that pulls models through the corporate proxy, trusts the inspection certificate, and still answers local API calls directly. Each step ends with a check you can run before moving on.

  1. Confirm proxy details and allowed destinations

    The network team confirms the proxy host, port, and the destinations it allows outbound, including the Ollama model registry hostnames your environment must reach. Ask whether the proxy performs TLS inspection, because that decides whether you need a CA certificate in the next step. Ask them to confirm the list in writing and to name the owner of any change. You are done when you hold a short document with the host, port, allowed hostnames, and inspection status, and a test request from a machine on the same network segment reaches the proxy. Confirm the exact destinations against the Ollama version you run, since registry hosts can change between releases.

  2. Install the proxy CA certificate on the host

    The systems administrator installs the proxy's root or intermediate CA certificate into the operating system trust store on the Ollama host, using the method for that distribution. Ask the network team for the certificate in PEM format and confirm its validity dates and issuer before installing it. Restart nothing yet. The check is a TLS request through the proxy that completes without a certificate error, for example a curl call with the proxy variable set against an allowed HTTPS destination. Confirm the trust store path and commands against your operating system version, because they differ between distributions.

  3. Add the CA certificate to the container image

    If Ollama runs in a container, the platform team adds the same CA certificate to the image build so the container trusts the inspection certificate without manual steps at runtime. Copy the certificate into the base image's trust directory and run the distribution's trust update command during the build. Rebuild the image and start a test container. The check is a curl call from inside the container to an allowed HTTPS destination through the proxy, which should return without a certificate error. Confirm the image base and trust commands against the image you use.

  4. Set HTTPS_PROXY and NO_PROXY on the service

    The administrator adds HTTPS_PROXY with the proxy URL and NO_PROXY with localhost, 127.0.0.1, and any internal hostnames that must bypass the proxy to the Ollama service's environment, usually through a systemd drop-in or the container's environment configuration. Set HTTPS_PROXY for outbound model pulls and keep NO_PROXY covering 127.0.0.1 so local clients skip the proxy. Avoid setting HTTP_PROXY for local API traffic, since it can route client connections to 127.0.0.1:11434 through the proxy and cause failures. The check is that the service's effective environment shows both variables, which you can confirm with the service manager's show command or the container's inspect output.

  5. Restart the service and read the startup log

    The administrator restarts the Ollama service with the service manager, or restarts the container, so the new environment takes effect. Then read the service log from the start of the restart. You are looking for the server listening on 127.0.0.1:11434 with no errors about certificates or connection timeouts. Ask whether your Ollama version writes proxy-related messages to this log, and confirm the log location for your install method. The check is a clean startup entry in the log and a successful response from the local API, which is verified in the final step.

  6. Pull a small test model through the proxy

    The administrator pulls a small model that is already approved for testing, using the Ollama command line on the host or inside the container. Choose a small model so the test stays short and the download is easy to verify. Watch the pull output for progress and for any error about TLS, proxy authentication, or a blocked host. The check is that the model appears in the local model list after the pull completes. If the pull fails, return to step one and confirm the allowed destinations with the network team, since blocked registry hosts are the most common cause.

  7. Verify the local API answers without the proxy

    The administrator sends a request to the local API at localhost on port 11434 with curl, which should bypass the proxy because of the NO_PROXY entry. A successful check is a JSON response from the tags or generate endpoint that lists the test model or returns generated text. Repeat the call from a client on the same host and from a container on the same network if applicable. Also confirm that a failed proxy does not affect this call by reviewing that the request still succeeds when the proxy is unreachable from the host. Confirm the endpoint paths and response fields against the Ollama API documentation for your version.

Where proxy variables apply on host, container and Docker daemon

When Ollama runs as a systemd service, the model downloads come from the Ollama process itself, so the proxy variables must be set in that service's environment, not in your login shell. Shell exports such as export HTTPS_PROXY in a terminal are not inherited by a service started at boot. Add an override file with systemctl edit ollama.service and place the variables under an [Service] section, using Environment= lines. Then run systemctl daemon-reload and systemctl restart ollama so systemd reads the change.

  • Override file: the drop-in created by systemctl edit is stored under /etc/systemd/system/ollama.service.d/, and the exact path depends on your distribution and how Ollama was installed.
  • Common mistake: setting HTTP_PROXY only. Model pulls use HTTPS, so set HTTPS_PROXY and include any internal hosts in NO_PROXY.
  • Reload step: skipping daemon-reload leaves the old environment in place even after a restart.
  • Verification: run systemctl show ollama -p Environment to confirm the variables, then run ollama pull for a small model and check the service journal with journalctl -u ollama.

Confirm the unit name and install layout on your own servers before you edit anything, since they vary by distribution and install method.

Security risks of proxying model downloads and cloud calls

Routing Ollama through a corporate proxy moves trust and visibility to the network team, not just the server. The cards below cover what the proxy and its certificate can see and change, and how to keep local traffic, cloud traffic and API keys apart so the setup stays reviewable.

CA trust scope

An inspection CA added to the host or container trust store is trusted by every process on that system that reads the same store, not only by Ollama. Before installing it, confirm which trust store Ollama's process uses, which other services share the host, and who approves the CA. Record the CA's owner and expiry so it can be removed when the proxy changes.

Proxy logs of pull metadata

A proxy that inspects or logs outbound requests will record model pull activity, including model names, tags, timestamps and the requesting host. Ask the network team what is retained, for how long, and who can read those logs. If model names are themselves sensitive, agree on log filtering before the first pull rather than after an audit question.

Separating cloud from local traffic

Local inference through localhost:11434 does not require authentication and, per Ollama, does not send your prompts or data out when run locally. Cloud features and direct cloud inference are a separate path. Set OLLAMA_NO_CLOUD=1 or the server configuration file so cloud calls cannot happen unintentionally, and confirm with a test that prompts do not leave the network.

Ollama FAQ

API keys as Bearer tokens

Direct calls to ollama.com/api and ollama.com/v1 need an API key sent as a Bearer token. That token grants access to the cloud account, so it must not be written into shared proxy configuration, environment files in source control or the same unit file as the proxy settings. Store it in a secrets manager, scope it to a named user or service, and rotate it when people leave.

Ollama API authentication

Updates through an approved channel

Proxying downloads means the binary and model artifacts take a path your security team must approve. Pin the Ollama version you have tested, pull updates only through the internal channel, and check release notes before upgrading. Ollama ships frequent releases, so confirm which release line your approved channel mirrors and how security fixes reach it.

Ollama GitHub releases

Documenting the proxy exception list

Hosts that bypass the proxy through NO_PROXY are a control decision and should be written down. List each exempted host, the reason it bypasses inspection, the owner and the review date. Auditors will ask how local API traffic at port 11434 is handled, so the record should show that the exception list matches the network design.

What running Ollama behind a proxy costs and needs from your team

How much effort does running Ollama behind a corporate proxy take?

The effort depends on how many hosts and containers need to pull models, how the proxy inspects traffic, and how fast your change control process moves. A single Linux server with one proxy setting and a documented CA certificate is a small task. Many hosts, several container runtimes and a proxy that rewrites HTTPS traffic add configuration, testing and sign-off steps. DeployOpen works from a written scope, so the effort is set out per environment and confirmed before work starts, not estimated from a generic figure.

What drives the cost of proxy work for Ollama?

Cost follows the number of hosts, the number of containers that pull models, the inspection policy on the proxy, and the change control steps your organization requires. Each item adds configuration, testing and documentation work. Two other factors matter: whether the proxy re-signs HTTPS traffic with an internal CA, which needs certificate distribution to every client, and whether the Docker daemon, systemd services and application containers each need their own proxy settings.

Can our own team set up Ollama behind a proxy without a partner?

Yes, many teams do this in-house, especially when they already manage Linux services and container runtimes. The work is mostly configuration and verification: setting HTTPS_PROXY for the Ollama service, installing the proxy's CA certificate where clients trust it, configuring the Docker daemon, and confirming that ollama pull completes. A partner adds value when the environment is large, the proxy policy is complex, or the team needs a documented, repeatable build with tests for each host type.

What does the proxy work need from the network, security and platform teams?

The network team confirms the proxy address, allowed destinations for model downloads and whether the proxy performs TLS inspection. The security team approves the CA certificate that is installed on clients and reviews which model sources are allowed. The platform team owns the service files, container settings and host patching. Agreeing these responsibilities early avoids rework, because a change to the proxy policy usually affects the service configuration on every host.

Is proxy configuration a one-time task or does it recur?

It is partly one-time and partly recurring. The initial setup covers proxy variables, certificate installation and Docker daemon settings. Recurring work includes renewing the CA certificate before it expires, updating the proxy address or allowed destinations when the network changes, and retesting model pulls after each Ollama upgrade, since release changes can affect how the client reaches its model source. Plan these as operating tasks with an owner, not as a project that ends at go-live.

What should we ask for in a quote for proxy work?

Ask for the written scope first: the list of hosts and container runtimes, the proxy type and whether it inspects TLS, the destinations that must be reachable, and the documents you will receive. Ask what is included in testing, such as pulls from each host type and a check after a restart. Ask who performs certificate renewal and upgrade retesting after handover, and what the process is for changes requested later. A quote without these items cannot be compared with another.

What happens if the proxy blocks a model source?

Ollama cannot pull the model, and the pull fails with a network or certificate error. Start by checking the proxy logs for the denied destination and confirming the host variables are set in the service environment, not only in your shell. If the source is blocked by policy, the decision belongs to your security team: they can allow the destination, or you can load approved weights from a local directory instead. Document the decision, because a later proxy change could reopen the same failure.

What to confirm in your environment before rollout

Pulling models through a corporate proxy depends on details that live outside Ollama: how your network team inspects traffic, which hosts are reachable, and which versions your hosts run. The items below are the checks that most often decide whether the first pull succeeds and whether the setup stays working after upgrades.

Proxy product and TLS inspection

Confirm the exact proxy or secure web gateway in use and whether it decrypts HTTPS traffic. If it does, every client that talks to the model source must trust the inspection CA, or pulls fail with certificate errors. Ask the network or security team for the CA certificate file, its format, and which hosts or categories are exempted from inspection. Check the vendor's documentation for how it handles large binary downloads, since model files are many gigabytes and some gateways apply file size or timeout limits to them.

Reachable model source hosts

Ask the network team whether the proxy allowlist permits the hosts Ollama contacts to download models and check for updates, and whether those rules allow the full download path rather than only the first request. Ollama's own documentation and release notes are the place to confirm which endpoints a given version uses, because they can change between releases. Ask whether a test pull of a small model completes end to end from the Ollama host before anyone plans a larger model set.

Ollama FAQ

Ollama version and proxy variable support

Record the exact Ollama version you plan to run and confirm in the release notes how that version reads proxy settings, including whether it honors HTTPS_PROXY and NO_PROXY for model pulls. Pin the version in your change record, because proxy handling is the kind of behavior that shifts between releases. The GitHub release history lists each version and its notes, so compare the version you intend to deploy against the one you tested.

Ollama release notes

Docker and systemd versions on the host

Confirm the Docker Engine version and the systemd version on each host where Ollama runs. Proxy settings for the Docker daemon are read from a systemd drop-in, not from the shell, so the systemd version and unit layout determine whether the daemon picks up HTTP_PROXY or HTTPS_PROXY after a restart. Check the Docker and systemd documentation for your distribution, and confirm that the daemon's proxy settings and the container's environment are both set, since they serve different steps of the pull.

Whether direct cloud access is permitted

Ask the security team whether any Ollama host may reach ollama.com or the cloud inference endpoints at all. Local model serving does not need them, and many organizations choose to block them outright. If cloud features are not approved, plan to turn them off on the server, and confirm that the policy is enforced at the network layer as well as in configuration. Cloud inference uses a Bearer API key, so any allowed outbound path also needs a decision about where that key is stored.

Ollama API authentication

Client tools that ignore proxy settings

Identify every tool on the same host that will run Ollama commands or call the API, including scripts, IDE plugins, monitoring agents and configuration management jobs. Some tools ignore HTTPS_PROXY, use their own HTTP stack, or resolve hosts differently, so a working shell session does not prove that a service account or scheduled job will work. Test each tool under the same account and environment it will run with, and confirm that local API traffic to 127.0.0.1 is excluded from the proxy through NO_PROXY.

How DeployOpen scopes and supports proxy configuration for Ollama

DeployOpen plans proxy access for Ollama as part of the server it runs in your infrastructure, so model pulls, certificate trust and container settings are agreed before anything changes. The work is delivered as a fixed-scope engagement with written deliverables, and ongoing support is available as a retainer.

How we scope

  • Map which hosts, containers and services need outbound access through your proxy and which must stay internal.
  • Confirm the proxy address, authentication method and whether it inspects TLS traffic to model registries.
  • Agree in writing whether the scope covers the host, Docker daemon, containers or all three, and which environments are included.

How we build

  • Configure HTTPS_PROXY and NO_PROXY for the Ollama service on the host, using a systemd override where Ollama runs under systemd.
  • Install your proxy's CA certificate into the trust store used by the Ollama process and confirm model pulls complete.
  • Set Docker daemon proxy values and container environment variables, then test a clean model pull from each affected layer.

How we hand over

  • Deliver a written configuration record listing every proxy variable, file path, certificate location and the reason for each setting.
  • Document the pull test steps, expected output and the logs your team should check when a pull fails.
  • Provide a change procedure for certificate renewal, proxy address changes and Ollama version upgrades that touch the same settings.

How we support

  • Offer retesting after proxy, certificate or Ollama version changes so pulls keep working as the environment moves.
  • Review the configuration with your network and security teams before sign-off, so they can confirm it matches policy.
  • Provide ongoing support, upgrades and continuous testing through a retainer agreed in writing with your scope.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.