How to get Cloudflare Tunnel to connect to the local IP service and not have traffic routed through the tunnel, when on a local network?

I currently have some services connected to CF Tunnels (ex: service1.domain.com; service2.domain.com, etc.) on my Mac server

service1.domain.com points to 192.168.12.196:port1
service2.domain.com points to 192.168.12.196:port2

Whenever I go to service1.domain.com on my local network (which is on the same network as my server), the traffic is being routed through CF tunnels. However, I instead want it set up such that whenever I’m on my local network and type in service1.domain.com, the traffic is routed to the local IP (192.168.12.196:port1 and NOT through the tunnel). I only want traffic to hit the tunnel whenever I’m not on my local network.

Is this possible to set up? If so, how do I go about this? I

Are you using Cloudflare Tunnel with WARP routing or HTTP ingress rules?

HTTP ingress rules I believe

This is what my config file is set up as

tunnel: TUNNEL-ID
credentials-file: /path/to/JSON/file

ingress:
- hostname: service1.domain.com
service: http://192.168.12.196:port1
- hostname: service2.domain.com
service: http://192.168.12.196:port2
- service: http_status:404

In that case you will need a split-horizon DNS setup. This is not something you can do natively with Cloudflare’s DNS.

1 Like