New Tool Radar

Local AI

How to Reach Ollama from Outside Your Home with a Cloudflare Tunnel

Reach your home Ollama server from anywhere without opening a router port: run cloudflared with the URL and host-header flags from Ollama's FAQ, then call the tunnel address.

Schematic diagram with three steps: run cloudflared pointing at localhost:11434, give the tunnel a public hostname, and call it from anywhere.

Ollama binds 127.0.0.1 port 11434 by default, so from your own machine it answers and from anywhere else it does not. The traditional fix is port forwarding on your router, plus a public IP address and manual TLS certificates — error-prone and not beginner-friendly, as one Cloudflare Tunnel guide puts it. A Cloudflare Tunnel is the alternative: cloudflared, a small program on your server, makes an outbound connection to Cloudflare, and incoming requests flow through Cloudflare’s infrastructure to your server without you exposing any public ports.

Two ways to run the tunnel

Way What you do When to use it
Quick Tunnel Use an isolated, disposable test service. A Quick Tunnel provides a public URL. Keep the Ollama API out of this test.
Named tunnel Install cloudflared, create a tunnel in the Cloudflare Zero Trust dashboard, and add a public hostname such as ollama.example.de pointing to http://localhost:11434 For real use: the address stays the same, and Cloudflare handles the TLS certificate for you

For the named tunnel, keep Ollama on localhost. Create a Cloudflare Access application and an allow policy before adding the public hostname, and test access with both a signed-out and an authorized session.

Lock the door before you publish it

A tunnel does not open inbound ports, but it is not automatically safe: without an access rule, your Ollama service is publicly accessible to anyone who learns the hostname, and Ollama’s API is unauthenticated, so anyone who reaches it can use your models. The tunnel guide’s advice is to enable Access Rules in the dashboard — for an Ollama instance you use alone, restricting access to your own email address is highly recommended — and to keep Ollama listening only on localhost, so a configuration mistake does not expose it on your local network as well. A VPN such as Tailscale is a different route to the same goal, for readers who would rather connect networks than publish a service.

Try it: call your server from elsewhere

Use a named tunnel behind a Cloudflare Access policy. Open the hostname in a private browser window and confirm that signed-out requests are blocked. Sign in with an authorized account and confirm that the service responds. Expected result from the documentation. We did not create a tunnel or expose a server for this example.

Limits

A tunnel needs your server to be on and reachable: if the server goes offline, the tunnel breaks until it is back. The named tunnel needs a domain managed at Cloudflare, and the free Zero Trust tier covers the core features but costs can kick in with many users or log data. The trial address is temporary, so do not build anything permanent on it. We did not test any tunnel ourselves.

Sources

See all