Argo Tunnel fails to connect if origin isn't ready

I have been using Argo Tunnel for a while now. When I first started exposing my origin application it worked great, the app was fresh and new and started super quick.

However, as my app (and its database) grew in size, it takes a little longer before it enters a state where it is ready to serve requests after a reboot.

What this generally means is that Argo comes up before the app is ready, and I get presented with the following in my log:

getsockopt: connection refused","level":"error","msg":"unable to connect to the origin","time"

That means Argo never actually starts, because it doesn’t think the source app is ready. It never re-attempts to connect which usually meant i had to manually log into the server and restart Cloudflared.

I have temporarily fixed this by sleeping Cloudflared on start for 30 seconds, but it may be worth implementing a “retry” period when Cloudflared starts.

Just a thought :slight_smile:

I had the same problem and solved it by modifying the Cloudflared.service unit that gets created when installing argo tunnel as a system service. My server runs a nginx docker container so I modified Cloudflared.server to wait until the docker service has started and then just set the restart directive to always so that the tunnel will connect once the container is running.

Description=Argo Tunnel

ExecStart=/usr/local/bin/Cloudflared --config /etc/Cloudflared/config.yml --origincert /etc/Cloudflared/cert.pem --no-autoupdate


Hope that helps!

Continuing the discussion from Argo Tunnel fails to connect if origin isn't ready:

[quote=“alrhos, post:2, topic:43059”]
[/quote] juyoung