Help with cloudflare tunnels reddit / selfhosted ---------------------------------------------------------------------- somanythingsimean · 2023-12-21 16:52 Cloudflare Tunnels in Docker - 404 errors, what am I missing? Hi all. I cannot get Tunnels to work in my configuration. I just get this when I update the configuration: tunnel | 2023-12-21T16:12:20Z INF Updated to new configuration config="{\"ingress\":[{\"hostname\":\"DOMAIN.com\",\"ori ginRequest\":{},\"service\":\"http://nginx:80\"},{\"hostname\":\"DOMAI N.com\",\"originRequest\":{},\"service\":\"http://nginx:443\"},{\"serv ice\":\"http_status:404\"}],\"warp-routing\":{\"enabled\":false}}" version=14 and when visiting the domain I get this: tunnel | 2023-12-21T16:17:53Z ERR error="Unable to reach the origin service. The service may be down or it may not be responding to traffic from cloudflared: dial tcp: lookup nginx on : no such host" cfRay=839170156afe3914-IAD event=1 ingressRule=0 originService=http://nginx:80 I have the tunnel successfully connected via the docker container, but it refuses to reach. For the hostname I have tried "localhost:80", "nginx:80", "[internal.docker.host:80](https://internal.docker.host:80)", and the internal IP of the docker container I am trying to reach, all to no avail. I've also stopped and restarted the docker network, but it just doesn't seem to be reaching. My compose file looks like this: cloudflared-tunnel: image: cloudflare/cloudflared:latest container_name: tunnel environment: - TZ=America/New_York - TUNNEL_TOKEN= restart: always command: tunnel run network_mode: "host" What could I possibly be missing here? One other question is why would Tunnels be looking up my services on port 53 of my IP? Because that seems like it could be causing the issue. ---------------------------------------------------------------------- kraxyk · 2023-12-21 18:18 I actually do this with all of my tunnels, but I don't use nginx. Typically I just let cloud flare go right to the service itself. However, having worked with nginx previously, I would say have you verified that you can access the service behind without using the tunnel? Your error seems to indicate it's having a hard time looking up the address associated with the host name nginx. What is the error message if you have Cloudflare tunneled direct to the IP address? ---------------------------------------------------------------------- somanythingsimean · 2023-12-21 18:25 Now that you say this, I feel like I need to do something to expose my docker network. Any idea what variables I should edit for the network to make it available outside of the machine? Because if it's refusing connection that makes sense. I can't access the docker network by using the internal IP or my IP from say, my phone, etc. ---------------------------------------------------------------------- kraxyk · 2023-12-21 20:12 That's pretty suspicious. Depending on what operating system you run, is it possible you have a firewall in place that you have to explicitly open ports for? ---------------------------------------------------------------------- somanythingsimean · 2023-12-21 20:25 I've got a Tmobile Home Internet setup that I can't open ports on. Connected to it is a Gl.iNet router. I can open ports on it but I don't necessarily think anything is blocked. ---------------------------------------------------------------------- nickkrewson · 2023-12-21 22:04 If you are using Docker to host Cloudflared, and using Docker to host other containers too, "localhost" might not work the way you'd expect. For "localhost" to work, I think you have to have the Cloudflared Docker container using the host network, not a bridge network. If your Cloudflared Docker container is using a bridge network, "localhost" would have it referring to itself (the Cloudflared container), not the device that is hosting your Docker instance. In that case, you would use the local IP addresses of your other Docker containers when setting up your tunnels (which would likely all be in the same subnet of your Cloudflared container). Does that make sense? ---------------------------------------------------------------------- somanythingsimean · 2023-12-21 22:51 It makes sense, but I still can't get it to work. Just constant timeouts and refusals to connect. ---------------------------------------------------------------------- kraxyk · 2023-12-21 23:22 No, I don't mean your router. That is why you're using Cloudflare tunnels after all. I mean the computer or server that is actually running your service and your reverse proxy. A lot of operating systems do not have incoming connections allowed by default. ---------------------------------------------------------------------- somanythingsimean · 2023-12-21 23:51 Eh, I just ended up going with tailscale and it set up in seconds without fuss. Giving up on tunnels, I don't know what the issue was. ---------------------------------------------------------------------- ElrondMcBong231 · 2023-12-22 03:10 I had this problem like some weeks ago, after hours of searching for solution I changed the network of my cloudflared container and in zero trust tunnel added the IP mask for private network in the settings. I would send some screenshots but I'm on phone right now. Hope this works for you ---------------------------------------------------------------------- somanythingsimean · 2023-12-22 03:22 Thanks, I ended up using tailscale and it worked immediately. Not sure what the problem was honestly.