Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cloudflared hangs after internet connection severed #306

Open
ivanjx opened this issue Feb 5, 2021 · 43 comments
Open

Cloudflared hangs after internet connection severed #306

ivanjx opened this issue Feb 5, 2021 · 43 comments
Labels
Area: DNS-Proxy Issues related to DNS-Proxy functionality in cloudflared Priority: Deferred Issue has been placed in backlog

Comments

@ivanjx
Copy link

ivanjx commented Feb 5, 2021

I am running cloudflared on ubuntu arm (raspberry pi) as a proxy dns. Whenever i restarted my router, cloudflared hangs and stops working and cant connect until i restarted the cloudflared process. Here is my cloudflared command:

cloudflared proxy-dns --port 5053 --upstream https://94.140.14.14/dns-query

Any idea of how to make cloudflared process restarts automatically if connection is lost and restored? Sorry if this has been discussed before. Thanks.

@vidarak
Copy link

vidarak commented Feb 6, 2021

First of all, make sure you do not have version 2020.12.0 (which has issues with reconnecting tunnel connections specifically)

@ivanjx
Copy link
Author

ivanjx commented Feb 7, 2021

Thanks @vidarak. I updated to this version (https://github.com/cloudflare/cloudflared/releases/tag/2021.2.1) but the issue still persists. Here is what -version prints:
cloudflared version DEV (built unknown)

Here is the cloudflared log says after i intentionally interrupt the connection (by restarting my modem router):

Feb 07 07:00:47 home-server cloudflared[191786]: 2021-02-07T00:00:47Z ERR failed to connect to an HTTPS backend "https://94.140.14.14/dns-query" error="failed to perform an HTTPS request: Post \"https://94.140.14.14/dns-query\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)"
Feb 07 07:00:47 home-server cloudflared[191786]: 2021-02-07T00:00:47Z ERR failed to connect to an HTTPS backend "https://94.140.14.14/dns-query" error="failed to perform an HTTPS request: Post \"https://94.140.14.14/dns-query\": net/http: request canceled (Client.Timeout exceeded while awaiting headers)"
Feb 07 07:00:48 home-server cloudflared[191786]: 2021-02-07T00:00:48Z ERR failed to connect to an HTTPS backend "https://94.140.14.14/dns-query" error="failed to perform an HTTPS request: Post \"https://94.140.14.14/dns-query\": net/http: request canceled (Client.Timeout exceeded while awaiting headers)"
Feb 07 07:00:48 home-server cloudflared[191786]: 2021-02-07T00:00:48Z ERR failed to connect to an HTTPS backend "https://94.140.14.14/dns-query" error="failed to perform an HTTPS request: Post \"https://94.140.14.14/dns-query\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)"
Feb 07 07:00:49 home-server cloudflared[191786]: 2021-02-07T00:00:49Z ERR failed to connect to an HTTPS backend "https://94.140.14.14/dns-query" error="failed to perform an HTTPS request: Post \"https://94.140.14.14/dns-query\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)"
Feb 07 07:00:50 home-server cloudflared[191786]: 2021-02-07T00:00:50Z ERR failed to connect to an HTTPS backend "https://94.140.14.14/dns-query" error="failed to perform an HTTPS request: Post \"https://94.140.14.14/dns-query\": context deadline exceeded"
Feb 07 07:00:50 home-server cloudflared[191786]: 2021-02-07T00:00:50Z ERR failed to connect to an HTTPS backend "https://94.140.14.14/dns-query" error="failed to perform an HTTPS request: Post \"https://94.140.14.14/dns-query\": net/http: request canceled (Client.Timeout exceeded while awaiting headers)"
Feb 07 07:00:51 home-server cloudflared[191786]: 2021-02-07T00:00:51Z ERR failed to connect to an HTTPS backend "https://94.140.14.14/dns-query" error="failed to perform an HTTPS request: Post \"https://94.140.14.14/dns-query\": net/http: request canceled (Client.Timeout exceeded while awaiting headers)"
Feb 07 07:00:51 home-server cloudflared[191786]: 2021-02-07T00:00:51Z ERR failed to connect to an HTTPS backend "https://94.140.14.14/dns-query" error="failed to perform an HTTPS request: Post \"https://94.140.14.14/dns-query\": net/http: request canceled (Client.Timeout exceeded while awaiting headers)"
Feb 07 07:00:51 home-server cloudflared[191786]: 2021-02-07T00:00:51Z ERR failed to connect to an HTTPS backend "https://94.140.14.14/dns-query" error="failed to perform an HTTPS request: Post \"https://94.140.14.14/dns-query\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)"

This is dig command i tried after connection interruption:

; <<>> DiG 9.16.1-Ubuntu <<>> @127.0.0.53 reddit.com
; (1 server found)
;; global options: +cmd
;; connection timed out; no servers could be reached

And this is the pihole log when this happens (as pihole uses cloudflared as an upstream dns):

Feb  7 07:09:31: query[A] dcg.microsoft.com from 192.168.20.100
Feb  7 07:09:31: forwarded dcg.microsoft.com to 127.0.0.1
Feb  7 07:09:31: forwarded dcg.microsoft.com to 127.0.0.1
Feb  7 07:09:32: query[A] dcg.microsoft.com from 192.168.20.100
Feb  7 07:09:32: forwarded dcg.microsoft.com to 127.0.0.1
Feb  7 07:09:32: forwarded dcg.microsoft.com to 127.0.0.1
Feb  7 07:09:33: query[A] edge.activity.windows.com from 192.168.20.100
Feb  7 07:09:33: forwarded edge.activity.windows.com to 127.0.0.1
Feb  7 07:09:33: forwarded edge.activity.windows.com to 127.0.0.1
Feb  7 07:09:33: query[A] dcg.microsoft.com from 192.168.20.100
Feb  7 07:09:33: forwarded dcg.microsoft.com to 127.0.0.1
Feb  7 07:09:33: forwarded dcg.microsoft.com to 127.0.0.1
Feb  7 07:09:35: query[A] n-devs-dcipc.tplinkcloud.com from 192.168.20.21
Feb  7 07:09:35: query[A] n-devs-dcipc.tplinkcloud.com from 192.168.20.22
Feb  7 07:09:35: query[A] dcg.microsoft.com from 192.168.20.100
Feb  7 07:09:35: forwarded dcg.microsoft.com to 127.0.0.1
Feb  7 07:09:35: forwarded dcg.microsoft.com to 127.0.0.1
Feb  7 07:09:35: query[PTR] 21.20.168.192.in-addr.arpa from 127.0.0.1
Feb  7 07:09:35: forwarded 21.20.168.192.in-addr.arpa to 127.0.0.1
Feb  7 07:09:35: forwarded 21.20.168.192.in-addr.arpa to 127.0.0.1

Pretty sure it is not the pihole's fault since i restarted cloudflared and everything works as normal again.

@Erroneuz
Copy link

Yeah, can confirm i've seen this issue for quite some time now. A reboot of cloudflared, which I run in docker solves it every time.

@vidarak
Copy link

vidarak commented Feb 11, 2021

It wouldn't surprise me if this is due to the default retries value being way too low. It is supposed to be only 5 according to Cloudflare support - with exponential backoff. You seem to have 10 entries in your log file within a couple of seconds (assuming 2 entries for every failure). It doesn't seem to do exponential backoff in your case but still max out on 5 retries. Probably just another bug that it doesn't do the backoff, but it doesn't remove the need to increase retries anyway.

I set retries to at least 99 in every config because of this wrong default retry value decision by Cloudflare.

@ivanjx
Copy link
Author

ivanjx commented Feb 11, 2021

can you show me the sample config of that @vidarak ?

@adamchalmers
Copy link
Contributor

I suspect this is the same problem as #302

@vidarak
Copy link

vidarak commented Feb 11, 2021

can you show me the sample config of that @vidarak ?

I've added these 2 lines to configs lately (but due to a now resolved bug, the retries option only work on the most recent releases... 2020.11.11 or later):
retries: 99
protocol: http2

@ivanjx
Copy link
Author

ivanjx commented Feb 11, 2021

can this be translated into command line config? i dont use any config file for cloudflared @vidarak

@vidarak
Copy link

vidarak commented Feb 11, 2021

it's the --retries option

@ivanjx
Copy link
Author

ivanjx commented Feb 11, 2021

thanks for the suggestion @vidarak but it does not seem to fix the problem for me. i tried:
cloudflared --retries 99 proxy-dns --port 5053 --upstream https://94.140.14.14/dns-query
but the problem still persists and i have to restart cloudflared service to make it work again. here is what the log says at connection interruption:

Feb 12 06:25:06 home-server cloudflared[243291]: 2021-02-11T23:25:06Z ERR failed to connect to an HTTPS backend "https://94.140.14.14/dns-query" error="failed to perform an HTTPS request: Post \"https://94.140.14.14/dns-query\": net/http: request canceled (Client.Timeout exceeded while awaiting headers)"
Feb 12 06:25:08 home-server cloudflared[243291]: 2021-02-11T23:25:08Z ERR failed to connect to an HTTPS backend "https://94.140.14.14/dns-query" error="failed to perform an HTTPS request: Post \"https://94.140.14.14/dns-query\": net/http: request canceled (Client.Timeout exceeded while awaiting headers)"
Feb 12 06:25:08 home-server cloudflared[243291]: 2021-02-11T23:25:08Z ERR failed to connect to an HTTPS backend "https://94.140.14.14/dns-query" error="failed to perform an HTTPS request: Post \"https://94.140.14.14/dns-query\": net/http: request canceled (Client.Timeout exceeded while awaiting headers)"
Feb 12 06:25:09 home-server cloudflared[243291]: 2021-02-11T23:25:09Z ERR failed to connect to an HTTPS backend "https://94.140.14.14/dns-query" error="failed to perform an HTTPS request: Post \"https://94.140.14.14/dns-query\": net/http: request canceled (Client.Timeout exceeded while awaiting headers)"
Feb 12 06:25:09 home-server cloudflared[243291]: 2021-02-11T23:25:09Z ERR failed to connect to an HTTPS backend "https://94.140.14.14/dns-query" error="failed to perform an HTTPS request: Post \"https://94.140.14.14/dns-query\": net/http: request canceled (Client.Timeout exceeded while awaiting headers)"
Feb 12 06:25:10 home-server cloudflared[243291]: 2021-02-11T23:25:10Z ERR failed to connect to an HTTPS backend "https://94.140.14.14/dns-query" error="failed to perform an HTTPS request: Post \"https://94.140.14.14/dns-query\": net/http: request canceled (Client.Timeout exceeded while awaiting headers)"
Feb 12 06:25:10 home-server cloudflared[243291]: 2021-02-11T23:25:10Z ERR failed to connect to an HTTPS backend "https://94.140.14.14/dns-query" error="failed to perform an HTTPS request: Post \"https://94.140.14.14/dns-query\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)"
Feb 12 06:25:11 home-server cloudflared[243291]: 2021-02-11T23:25:11Z ERR failed to connect to an HTTPS backend "https://94.140.14.14/dns-query" error="failed to perform an HTTPS request: Post \"https://94.140.14.14/dns-query\": net/http: request canceled (Client.Timeout exceeded while awaiting headers)"
Feb 12 06:25:11 home-server cloudflared[243291]: 2021-02-11T23:25:11Z ERR failed to connect to an HTTPS backend "https://94.140.14.14/dns-query" error="failed to perform an HTTPS request: Post \"https://94.140.14.14/dns-query\": net/http: request canceled (Client.Timeout exceeded while awaiting headers)"
Feb 12 06:25:11 home-server cloudflared[243291]: 2021-02-11T23:25:11Z ERR failed to connect to an HTTPS backend "https://94.140.14.14/dns-query" error="failed to perform an HTTPS request: Post \"https://94.140.14.14/dns-query\": context deadline exceeded"

@CodeSmithian
Copy link

I have the same issue.

Raspberry Pi 3B+
Raspian
Pi-Hole

 $ cat /etc/debian_version
10.8

$ pihole -v
  Pi-hole version is v5.2.4 (Latest: v5.2.4)
  AdminLTE version is v5.4 (Latest: v5.4)
  FTL version is v5.7 (Latest: v5.7)

 $ cat /etc/cloudflared/config.yml
proxy-dns: true
proxy-dns-port: 5053
proxy-dns-upstream:
  - https://1.1.1.3/dns-query
  - https://1.0.0.3/dns-query
  #Uncomment following if you want to also want to use IPv6 for  external DOH lookups
  - https://[2606:4700:4700::1113]/dns-query
  - https://[2606:4700:4700::1003]/dns-query

$ cloudflared -v
cloudflared version 2021.1.5 (built 2021-01-18-1215 UTC)

Here is what the issue looks like when it happens:

 $ service cloudflared status
● cloudflared.service - Argo Tunnel
   Loaded: loaded (/etc/systemd/system/cloudflared.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2021-01-19 16:16:51 CST; 1 months 14 days ago
 Main PID: 19786 (cloudflared)
    Tasks: 11 (limit: 2063)
   CGroup: /system.slice/cloudflared.service
           └─19786 /home/pi/cloudflared --config /etc/cloudflared/config.yml --no-autoupdate --origincert /etc/cloudflar

Mar 05 09:19:10 dns-2 cloudflared[19786]: 9:19AM ERR failed to connect to an HTTPS backend "https://[2606:4700:4700::100
Mar 05 09:19:10 dns-2 cloudflared[19786]: 9:19AM ERR failed to connect to an HTTPS backend "https://1.0.0.3/dns-query" e
Mar 05 09:19:10 dns-2 cloudflared[19786]: 9:19AM ERR failed to connect to an HTTPS backend "https://[2606:4700:4700::111
Mar 05 09:19:10 dns-2 cloudflared[19786]: 9:19AM ERR failed to connect to an HTTPS backend "https://[2606:4700:4700::100
Mar 05 09:19:10 dns-2 cloudflared[19786]: 9:19AM ERR failed to connect to an HTTPS backend "https://1.0.0.3/dns-query" e
Mar 05 09:19:10 dns-2 cloudflared[19786]: 9:19AM ERR failed to connect to an HTTPS backend "https://[2606:4700:4700::111
Mar 05 09:19:10 dns-2 cloudflared[19786]: 9:19AM ERR failed to connect to an HTTPS backend "https://[2606:4700:4700::100
Mar 05 09:19:10 dns-2 cloudflared[19786]: 9:19AM ERR failed to connect to an HTTPS backend "https://1.0.0.3/dns-query" e
Mar 05 09:19:10 dns-2 cloudflared[19786]: 9:19AM ERR failed to connect to an HTTPS backend "https://[2606:4700:4700::111
Mar 05 09:19:10 dns-2 cloudflared[19786]: 9:19AM ERR failed to connect to an HTTPS backend "https://[2606:4700:4700::100

Restarting the service works every time to get it going again

 $ sudo service cloudflared restart
 $ service cloudflared status
● cloudflared.service - Argo Tunnel
   Loaded: loaded (/etc/systemd/system/cloudflared.service; enabled; vendor preset: enabled)
   Active: active (running) since Fri 2021-03-05 09:22:41 CST; 16s ago
 Main PID: 17176 (cloudflared)
    Tasks: 9 (limit: 2063)
   CGroup: /system.slice/cloudflared.service
           └─17176 /usr/local/bin/cloudflared --config /etc/cloudflared/config.yml --no-autoupdate --origincert /etc/clo
Mar 05 09:22:41 dns-1 systemd[1]: Starting Argo Tunnel...
Mar 05 09:22:41 dns-1 cloudflared[17176]: 2021-03-05T15:22:41Z INF Version DEV
Mar 05 09:22:41 dns-1 cloudflared[17176]: 2021-03-05T15:22:41Z INF GOOS: linux, GOVersion: go1.15.7, GoArch: arm
Mar 05 09:22:41 dns-1 cloudflared[17176]: 2021-03-05T15:22:41Z INF Settings: map[config:/etc/cloudflared/config.yml no-a
Mar 05 09:22:41 dns-1 cloudflared[17176]: 2021-03-05T15:22:41Z INF Adding DNS upstream url=https://1.1.1.3/dns-query
Mar 05 09:22:41 dns-1 cloudflared[17176]: 2021-03-05T15:22:41Z INF Adding DNS upstream url=https://1.0.0.3/dns-query
Mar 05 09:22:41 dns-1 cloudflared[17176]: 2021-03-05T15:22:41Z INF Adding DNS upstream url=https://[2606:4700:4700::1113
Mar 05 09:22:41 dns-1 cloudflared[17176]: 2021-03-05T15:22:41Z INF Adding DNS upstream url=https://[2606:4700:4700::1003
Mar 05 09:22:41 dns-1 cloudflared[17176]: 2021-03-05T15:22:41Z INF Starting DNS over HTTPS proxy server address=dns://lo
Mar 05 09:22:41 dns-1 systemd[1]: Started Argo Tunnel.

The issue seems to happen approximately once per month, give or take. Also, note that I have two redundant Raspberry Pis running this configuration, and they seem to fail at about the same time when they fail, and they fail the same exact way.

@adamchalmers
Copy link
Contributor

adamchalmers commented Mar 6, 2021

I believe this is fixed in #290. Try upgrading to the latest version. Feel free to reopen if that doesn't work!

@ivanjx
Copy link
Author

ivanjx commented Mar 6, 2021

@adamchalmers unfortunately it does not fix the error. I used this now:
cloudflared proxy-dns --port 5053 --upstream https://1.1.1.1/dns-query --max-upstream-conns 5
and version: cloudflared version 2021.2.5 (built 2021-02-23-1958 UTC)
and this is the log after disconnection:

Mar 07 06:23:22 home-server cloudflared[318365]: 2021-03-06T23:23:22Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.1.1.1/dns-query\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)"
Mar 07 06:23:27 home-server cloudflared[318365]: 2021-03-06T23:23:27Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.1.1.1/dns-query\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)"
Mar 07 06:23:27 home-server cloudflared[318365]: 2021-03-06T23:23:27Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.1.1.1/dns-query\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)"
Mar 07 06:23:30 home-server cloudflared[318365]: 2021-03-06T23:23:30Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.1.1.1/dns-query\": net/http: request canceled (Client.Timeout exceeded while awaiting headers)"
Mar 07 06:23:30 home-server cloudflared[318365]: 2021-03-06T23:23:30Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.1.1.1/dns-query\": net/http: request canceled (Client.Timeout exceeded while awaiting headers)"
Mar 07 06:23:34 home-server cloudflared[318365]: 2021-03-06T23:23:34Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.1.1.1/dns-query\": net/http: request canceled (Client.Timeout exceeded while awaiting headers)"
Mar 07 06:23:35 home-server cloudflared[318365]: 2021-03-06T23:23:35Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.1.1.1/dns-query\": net/http: request canceled (Client.Timeout exceeded while awaiting headers)"
Mar 07 06:23:36 home-server cloudflared[318365]: 2021-03-06T23:23:36Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.1.1.1/dns-query\": net/http: request canceled (Client.Timeout exceeded while awaiting headers)"
Mar 07 06:23:36 home-server cloudflared[318365]: 2021-03-06T23:23:36Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.1.1.1/dns-query\": net/http: request canceled (Client.Timeout exceeded while awaiting headers)"
Mar 07 06:23:38 home-server cloudflared[318365]: 2021-03-06T23:23:38Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.1.1.1/dns-query\": net/http: request canceled (Client.Timeout exceeded while awaiting headers)"
Mar 07 06:23:38 home-server cloudflared[318365]: 2021-03-06T23:23:38Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.1.1.1/dns-query\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)"
Mar 07 06:23:38 home-server cloudflared[318365]: 2021-03-06T23:23:38Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.1.1.1/dns-query\": net/http: request canceled (Client.Timeout exceeded while awaiting headers)"
Mar 07 06:23:38 home-server cloudflared[318365]: 2021-03-06T23:23:38Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.1.1.1/dns-query\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)"
Mar 07 06:23:40 home-server cloudflared[318365]: 2021-03-06T23:23:40Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.1.1.1/dns-query\": net/http: request canceled (Client.Timeout exceeded while awaiting headers)"
Mar 07 06:23:40 home-server cloudflared[318365]: 2021-03-06T23:23:40Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.1.1.1/dns-query\": context deadline exceeded"
Mar 07 06:23:41 home-server cloudflared[318365]: 2021-03-06T23:23:41Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.1.1.1/dns-query\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)"
Mar 07 06:23:41 home-server cloudflared[318365]: 2021-03-06T23:23:41Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.1.1.1/dns-query\": net/http: request canceled (Client.Timeout exceeded while awaiting headers)"
Mar 07 06:23:42 home-server cloudflared[318365]: 2021-03-06T23:23:42Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.1.1.1/dns-query\": net/http: request canceled (Client.Timeout exceeded while awaiting headers)"
Mar 07 06:23:42 home-server cloudflared[318365]: 2021-03-06T23:23:42Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.1.1.1/dns-query\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)"
Mar 07 06:23:42 home-server cloudflared[318365]: 2021-03-06T23:23:42Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.1.1.1/dns-query\": net/http: request canceled (Client.Timeout exceeded while awaiting headers)"
Mar 07 06:23:42 home-server cloudflared[318365]: 2021-03-06T23:23:42Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.1.1.1/dns-query\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)"
Mar 07 06:23:42 home-server cloudflared[318365]: 2021-03-06T23:23:42Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.1.1.1/dns-query\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)"
Mar 07 06:23:42 home-server cloudflared[318365]: 2021-03-06T23:23:42Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.1.1.1/dns-query\": net/http: request canceled (Client.Timeout exceeded while awaiting headers)"
Mar 07 06:23:43 home-server cloudflared[318365]: 2021-03-06T23:23:43Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.1.1.1/dns-query\": net/http: request canceled (Client.Timeout exceeded while awaiting headers)"
Mar 07 06:23:43 home-server cloudflared[318365]: 2021-03-06T23:23:43Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.1.1.1/dns-query\": net/http: request canceled (Client.Timeout exceeded while awaiting headers)"
Mar 07 06:23:43 home-server cloudflared[318365]: 2021-03-06T23:23:43Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.1.1.1/dns-query\": net/http: request canceled (Client.Timeout exceeded while awaiting headers)"
Mar 07 06:23:43 home-server cloudflared[318365]: 2021-03-06T23:23:43Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.1.1.1/dns-query\": net/http: request canceled (Client.Timeout exceeded while awaiting headers)"
Mar 07 06:23:43 home-server cloudflared[318365]: 2021-03-06T23:23:43Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.1.1.1/dns-query\": net/http: request canceled (Client.Timeout exceeded while awaiting headers)"
Mar 07 06:23:43 home-server cloudflared[318365]: 2021-03-06T23:23:43Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.1.1.1/dns-query\": net/http: request canceled (Client.Timeout exceeded while awaiting headers)"
Mar 07 06:23:45 home-server cloudflared[318365]: 2021-03-06T23:23:45Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.1.1.1/dns-query\": net/http: request canceled (Client.Timeout exceeded while awaiting headers)"
Mar 07 06:23:45 home-server cloudflared[318365]: 2021-03-06T23:23:45Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.1.1.1/dns-query\": net/http: request canceled (Client.Timeout exceeded while awaiting headers)"
Mar 07 06:23:45 home-server cloudflared[318365]: 2021-03-06T23:23:45Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.1.1.1/dns-query\": net/http: request canceled (Client.Timeout exceeded while awaiting headers)"
Mar 07 06:23:45 home-server cloudflared[318365]: 2021-03-06T23:23:45Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.1.1.1/dns-query\": net/http: request canceled (Client.Timeout exceeded while awaiting headers)"
Mar 07 06:23:45 home-server cloudflared[318365]: 2021-03-06T23:23:45Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.1.1.1/dns-query\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)"
Mar 07 06:23:46 home-server cloudflared[318365]: 2021-03-06T23:23:46Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.1.1.1/dns-query\": net/http: request canceled (Client.Timeout exceeded while awaiting headers)"
Mar 07 06:23:47 home-server cloudflared[318365]: 2021-03-06T23:23:47Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.1.1.1/dns-query\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)"
Mar 07 06:23:48 home-server cloudflared[318365]: 2021-03-06T23:23:48Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.1.1.1/dns-query\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)"
Mar 07 06:23:48 home-server cloudflared[318365]: 2021-03-06T23:23:48Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.1.1.1/dns-query\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)"
Mar 07 06:23:49 home-server cloudflared[318365]: 2021-03-06T23:23:49Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.1.1.1/dns-query\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)"
Mar 07 06:23:49 home-server cloudflared[318365]: 2021-03-06T23:23:49Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.1.1.1/dns-query\": net/http: request canceled (Client.Timeout exceeded while awaiting headers)"
Mar 07 06:23:50 home-server cloudflared[318365]: 2021-03-06T23:23:50Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.1.1.1/dns-query\": net/http: request canceled (Client.Timeout exceeded while awaiting headers)"
Mar 07 06:23:50 home-server cloudflared[318365]: 2021-03-06T23:23:50Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.1.1.1/dns-query\": net/http: request canceled (Client.Timeout exceeded while awaiting headers)"

the (temporary) fix is still the same, needs to restart cloudflared manually.

@ivanjx
Copy link
Author

ivanjx commented Mar 6, 2021

and please reopen this issue. thank you.

@adamchalmers adamchalmers reopened this Mar 7, 2021
@TownLake TownLake added the Priority: Deferred Issue has been placed in backlog label Mar 14, 2021
@pheiduck
Copy link

pheiduck commented Apr 2, 2021

Issue also exist on latest version

$ cloudflared -v
cloudflared version 2021.3.6 (built 2021-03-31-0851 UTC)

UPDATE: also exist on latest version

Systemd output after Router reconnect to WAN

Apr 03 03:42:13 raspberrypi cloudflared[25660]: 2021-04-03T01:42:13Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform an HTTPS request
Apr 03 03:42:14 raspberrypi cloudflared[25660]: 2021-04-03T01:42:14Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform an HTTPS request
Apr 03 03:42:14 raspberrypi cloudflared[25660]: 2021-04-03T01:42:14Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform an HTTPS request
Apr 03 03:42:14 raspberrypi cloudflared[25660]: 2021-04-03T01:42:14Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform an HTTPS request
Apr 03 03:42:14 raspberrypi cloudflared[25660]: 2021-04-03T01:42:14Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform an HTTPS request
Apr 03 03:42:14 raspberrypi cloudflared[25660]: 2021-04-03T01:42:14Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform an HTTPS request
Apr 03 03:42:14 raspberrypi cloudflared[25660]: 2021-04-03T01:42:14Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform an HTTPS request
Apr 03 03:42:14 raspberrypi cloudflared[25660]: 2021-04-03T01:42:14Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform an HTTPS request
Apr 03 03:42:14 raspberrypi cloudflared[25660]: 2021-04-03T01:42:14Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform an HTTPS request
Apr 03 03:42:15 raspberrypi cloudflared[25660]: 2021-04-03T01:42:15Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform an HTTPS request

@NeoDuder
Copy link

NeoDuder commented Apr 19, 2021

Also exists on 2021.4.0. Any loss of, or failover of, the WAN and Cloudflared just hangs until manually restarted....

Apr 19 14:05:51 PiHole cloudflared[1306]: 2021-04-19T13:05:51Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.1.1.1/dns-query\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)"
Apr 19 14:05:56 PiHole cloudflared[1306]: 2021-04-19T13:05:56Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.1.1.1/dns-query\": net/http: request canceled (Client.Timeout exceeded while awaiting headers)"
Apr 19 14:06:42 PiHole cloudflared[1306]: 2021-04-19T13:06:42Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.1.1.1/dns-query\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)"
Apr 19 14:06:47 PiHole cloudflared[1306]: 2021-04-19T13:06:47Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.1.1.1/dns-query\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)"
Apr 19 14:08:24 PiHole cloudflared[1306]: 2021-04-19T13:08:24Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.1.1.1/dns-query\": net/http: request canceled (Client.Timeout exceeded while awaiting headers)"
Apr 19 14:08:29 PiHole cloudflared[1306]: 2021-04-19T13:08:29Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.1.1.1/dns-query\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)"

This makes Cloudflared completely unusable for me tbh.

@tezgno
Copy link

tezgno commented Apr 27, 2021

Having the same problem, which for me makes cloudflared unusable for me as well. Switching to standard DNS until this can be resolved.

@NeoDuder
Copy link

Having the same problem, which for me makes cloudflared unusable for me as well. Switching to standard DNS until this can be resolved.

I've went with installing Unbound and recursive resolving using the root servers.

@moakesr
Copy link

moakesr commented May 9, 2021

Having same problem with Unifi and backup LTE connection, if it switches to backup connection and a different external IP then cloudflared hangs. Running latest editions of Pi-Hole, Cloudflared and Raspberry PI OS.

@KLEPTOROTH
Copy link

Same issue here. On version 2021.6.0 (built 2021-06-22-1034 UTC).

@ivanjx
Copy link
Author

ivanjx commented Dec 9, 2021

--max-upstream-conns 50 seems to fix it for me now

@ghost
Copy link

ghost commented Jan 8, 2022

I have this issue too. Except mine happens within 5mins of starting cloudflared service .

pi@pihole:~ $ pihole -v
  Pi-hole version is v5.7 (Latest: v5.8.1)
  AdminLTE version is v5.9 (Latest: v5.10.1)
  FTL version is v5.12.1 (Latest: v5.13)
pi@pihole:~ $ cloudflared -v
cloudflared version 2022.1.0 (built 2022-01-06-1626 UTC)
pi@pihole:~ $
oudflared/config.yml --no-autoupdate --origincert /etc/cloudfla>

ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns->
ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns->
ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns->
ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns->
ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns->
ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns->
ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns->
ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns->
ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns->
ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns->
~

abled; vendor preset: enabled)
 9min ago

EDIT: Changing to upstream--conns 50 has worked for me as well.

@elcajon
Copy link

elcajon commented Jul 18, 2022

Having same problem with Unifi and backup LTE connection, if it switches to backup connection and a different external IP then cloudflared hangs. Running latest editions of Pi-Hole, Cloudflared and Raspberry PI OS.

I am experiencing the same problem with cloudflared tunnel connections. If network is unavailable for a short amount of time the cloudflared service stucks after the defined --retries (default 5) value.
As the time between retries increases exponentially it isn't really helpful to increase retries. Wouldn't it be possible to add an option to define the wait-between-retries time to allow the network to reconnect again or to kill the service so it can be brought up again by e.g. systemd or Docker?

@KLEPTOROTH
Copy link

Having same problem with Unifi and backup LTE connection, if it switches to backup connection and a different external IP then cloudflared hangs. Running latest editions of Pi-Hole, Cloudflared and Raspberry PI OS.

I am experiencing the same problem with cloudflared tunnel connections. If network is unavailable for a short amount of time the cloudflared service stucks after the defined --retries (default 5) value. As the time between retries increases exponentially it isn't really helpful to increase retries. Wouldn't it be possible to add an option to define the wait-between-retries time to allow the network to reconnect again or to kill the service so it can be brought up again by e.g. systemd or Docker?

Better idea - use dnscrypt. Problem solved.

No one at CF cares about this issue that's been ongoing for years now. It won't be fixed anytime soon.

https://github.com/DNSCrypt/dnscrypt-proxy

Now I can rest assured that momentary internet drops won't end up in much longer outages.

@keegan-lillo
Copy link

I too ran into this issue with cloudflared tunnel when running a BlueBubbles Server on macOS and intermittent internet issues.

I have the following launch agent set up as a workaround and it seems to work okay. It basically exits the process if grep finds: "INF Retrying connection in up to 16s seconds" in the output. Then the launch agent will auto-restart thanks to the KeepAlive flag.

/Users/myusername/Library/LaunchAgents/com.cloudflare.cloudflared.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
	<dict>
		<key>Label</key>
		<string>com.cloudflare.cloudflared</string>
		<key>ProgramArguments</key>
		<array>
			<string>/usr/local/bin/bluebubbles-tunnel.sh</string>
		</array>
		<key>RunAtLoad</key>
		<true/>
		<key>StandardOutPath</key>
		<string>/Users/myusername/Library/Logs/com.cloudflare.cloudflared.out.log</string>
		<key>StandardErrorPath</key>
		<string>/Users/myusername/Library/Logs/com.cloudflare.cloudflared.err.log</string>
		<key>KeepAlive</key>
		<dict>
			<key>SuccessfulExit</key>
			<false/>
		</dict>
		<key>ThrottleInterval</key>
		<integer>5</integer>
	</dict>
</plist>

/usr/local/bin/bluebubbles-tunnel.sh

#! /bin/bash

echo "" > /Users/myusername/Library/Logs/com.cloudflare.cloudflared.out.log
echo "" > /Users/myusername/Library/Logs/com.cloudflare.cloudflared.err.log

/usr/local/bin/cloudflared tunnel run 2>&1 | while read line; do
  echo "$line" 
  echo "$line" | grep "INF Retrying connection in up to 16s seconds" -q && { exit 1; break; }
done

@marcosvrs
Copy link

Up! Same here.

@OIRNOIR
Copy link

OIRNOIR commented Aug 31, 2022

I am having the same issue and it's disrupting the service I provide. It would be great if this could be fixed soon. I'll try and find a workaround, but it won't be possible until I can get physical access to the server.

@sudarshan-reddy
Copy link
Contributor

The tunnel side of the issue is #724

There’s a commit in there that fixes this problem. You can build this from source if the need is urgent.

note that this is only for tunnel but not dns-proxy.

@CodeSmithian
Copy link

FWIW, My work-around is to force cloudflared to restart every 10 minutes or so.

$ cat /etc/cron.d/cloudflared
# /etc/cron.d/cloudflared: crontab entries for the cloudflared package
#
#
# Important Note!  This cronjob will NOT be executed if you are
# running systemd as your init system.  If you are running systemd,
# the cronjob.timer function takes precedence over this cronjob.  For
# more details, see the systemd.timer manpage.

# Example of job definition:
# .---------------- minute (0 - 59)
# |  .------------- hour (0 - 23)
# |  |  .---------- day of month (1 - 31)
# |  |  |  .------- month (1 - 12) OR jan,feb,mar,apr ...
# |  |  |  |  .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# |  |  |  |  |
# *  *  *  *  * user-name  command to be executed

SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

1 * * * * root test -x /usr/local/bin/cloudflared && systemctl restart cloudflared
10 * * * * root test -x /usr/local/bin/cloudflared && systemctl restart cloudflared
20 * * * * root test -x /usr/local/bin/cloudflared && systemctl restart cloudflared
30 * * * * root test -x /usr/local/bin/cloudflared && systemctl restart cloudflared
40 * * * * root test -x /usr/local/bin/cloudflared && systemctl restart cloudflared
50 * * * * root test -x /usr/local/bin/cloudflared && systemctl restart cloudflared

@slunat
Copy link

slunat commented Sep 26, 2022

Also having this issue, My instance only ever seems to last for about a day before erroring out and then I need to remote onto the server an close the current instance and start a new one. I have a backup tunnel luckily so its not causing any downtime for me but its a huge pain in the ass because this is my main server and I would like my traffic to go via this server ideally. If anyones got any solution for windows, please let me know. I am trying to find a way to terminate the script automatically at a certain time or maybe upon the error message and start a new one.

@DevinCarr DevinCarr added the Area: DNS-Proxy Issues related to DNS-Proxy functionality in cloudflared label Sep 26, 2022
@OIRNOIR
Copy link

OIRNOIR commented Apr 9, 2023

My solution was to have a PM2 instance assigned to the root user (so that it would have permission to restart pm2) that kept this code running:

"use strict";

const { exec } = require('node:child_process');

let restartNeeded = false;

setInterval(async () => {
	try {
		await fetch("https://oirnoir.dev/"); // Replace with literally any website with reasonable uptime and speed that can be fetched every 30 seconds
		console.log("Success!");
		if (restartNeeded) {
			console.log("Restarting cloudflared...");
			exec("systemctl restart cloudflared");
			restartNeeded = false;
		}
	} catch (err) {
		restartNeeded = true;
		console.log("Restart needed!");
	}
}, 30000);

The code sets restartNeeded when it detects a break in the internet connection. When the connection is restored, cloudflared is then restarted.

@KLEPTOROTH
Copy link

Why are people writing solutions to this broken software?!
You guys are putting more effort into this tool than the devs 😂😂.
Just use DNSCrypt, it properly handles outages, and AFAIK does everything this tool does:
https://github.com/DNSCrypt/dnscrypt-proxy

I switched to it since my earlier comment on July 18, 2022 and I've had no problems.

@jahanarun
Copy link

jahanarun commented Apr 22, 2023

I use cloudflared in docker and have fixed this by building a custom cloudflared image

Dockerfile:

FROM cloudflare/cloudflared AS source

FROM alpine

ARG user=nonroot
ARG home=/home/$user
RUN addgroup -S $user
RUN adduser \
    --disabled-password \
    --gecos "" \
    --home $home \
    --ingroup $user \
    $user

COPY --from=source --chown=$user /usr/local/bin/cloudflared /usr/local/bin/
RUN apk update && apk add --no-cache curl bind-tools

USER $user

ENTRYPOINT ["cloudflared", "--no-autoupdate"]

CMD ["version"]

docker-comose.yml

  cloudflared-dnsproxy:
    image: <your-custom-image>:latest
    container_name: "cloudflared-dnsproxy"
    command: proxy-dns
    restart: always
    environment:
      TZ: ${TZ}    
      TUNNEL_METRICS: "0.0.0.0:49312"
      TUNNEL_DNS_ADDRESS: "0.0.0.0"
      TUNNEL_DNS_PORT: 5053
      TUNNEL_DNS_UPSTREAM: "https://1.1.1.1/dns-query,https://1.0.0.1/dns-query"
    healthcheck:
      test: dig +short @127.0.0.1 -p5053 bing.com AAAA || exit 1
      interval: 30s
      retries: 1
    labels:
      - autoheal=true

  autoheal:
    image: willfarrell/autoheal
    container_name: "autoheal"
    restart: always
    environment:
      TZ: ${TZ}    
      AUTOHEAL_CONTAINER_LABEL: autoheal
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock

@TheFiZi
Copy link

TheFiZi commented Apr 23, 2023

Just want to add the underlying issue still persists even with 2023.4.1

I have a OpenSense Firewall and two PiHoles running on Ubuntu 22.04.2 LTS. When I perform firmware updates on the firewall that require a reboot, even with only one packet being dropped, cloudflared on both PiHoles will fail to reconnect to 1.1.1.1 an 1.0.0.1 and provide DoH services for my PiHoles.

A quick restart of cloudfared solves the issue.

root@CELERY-04:~# systemctl status cloudflared
● cloudflared.service - cloudflared DNS over HTTPS proxy
     Loaded: loaded (/etc/systemd/system/cloudflared.service; enabled; vendor preset: enabled)
     Active: active (running) since Sun 2023-04-23 02:27:45 UTC; 3min 11s ago
   Main PID: 3244 (cloudflared)
      Tasks: 6 (limit: 1026)
     Memory: 15.5M
        CPU: 70ms
     CGroup: /system.slice/cloudflared.service
             └─3244 /usr/local/bin/cloudflared proxy-dns --port 5053 --upstream https://1.1.1.1/dns-query --upstream https://1.0.0.1/dns-query

Apr 23 02:27:45 CELERY-04.tld cloudflared[3244]: 2023-04-23T02:27:45Z INF Starting DNS over HTTPS proxy server address=dns://localhost:5053
Apr 23 02:27:45 CELERY-04.tld cloudflared[3244]: 2023-04-23T02:27:45Z INF Starting metrics server on 127.0.0.1:33057/metrics
Apr 23 02:30:49 CELERY-04.tld cloudflared[3244]: 2023-04-23T02:30:49Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform a>
Apr 23 02:30:52 CELERY-04.tld cloudflared[3244]: 2023-04-23T02:30:52Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform a>
Apr 23 02:30:53 CELERY-04.tld cloudflared[3244]: 2023-04-23T02:30:53Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform a>
Apr 23 02:30:54 CELERY-04.tld cloudflared[3244]: 2023-04-23T02:30:54Z ERR failed to connect to an HTTPS backend "https://1.0.0.1/dns-query" error="failed to perform a>
Apr 23 02:30:55 CELERY-04.tld cloudflared[3244]: 2023-04-23T02:30:55Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform a>
Apr 23 02:30:56 CELERY-04.tld cloudflared[3244]: 2023-04-23T02:30:56Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform a>
Apr 23 02:30:56 CELERY-04.tld cloudflared[3244]: 2023-04-23T02:30:56Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform a>
Apr 23 02:30:57 CELERY-04.tld cloudflared[3244]: 2023-04-23T02:30:57Z ERR failed to connect to an HTTPS backend "https://1.0.0.1/dns-query" error="failed to perform a>

root@CELERY-04:~# date
Sun Apr 23 02:31:11 AM UTC 2023

@mengxin891029
Copy link

up! only if the ERR failed to connect ... message could produce a non-0 exit code, and re can at least use the Service to restart the cloudflared

@Speed7811
Copy link

Speed7811 commented Oct 27, 2023

The problem still exists in 2023.8.2. Tonight we have a internet disconnect of 10 minutes. After reconnecting all DNS queries not working. We are using PiHole with cloudflared.

The message in the logs are

...
Oct 27 05:00:42 pihole02 cloudflared[513]: 2023-10-27T05:00:42Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.1.1.1/dns-query\": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)"
Oct 27 05:00:42 pihole02 cloudflared[513]: 2023-10-27T05:00:42Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.1.1.1/dns-query\": context deadline exceeded"
Oct 27 05:00:42 pihole02 cloudflared[513]: 2023-10-27T05:00:42Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.1.1.1/dns-query\": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)"
Oct 27 05:00:42 pihole02 cloudflared[513]: 2023-10-27T05:00:42Z ERR failed to connect to an HTTPS backend "https://1.0.0.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.0.0.1/dns-query\": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)"
Oct 27 05:00:43 pihole02 cloudflared[513]: 2023-10-27T05:00:43Z ERR failed to connect to an HTTPS backend "https://1.0.0.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.0.0.1/dns-query\": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)"
Oct 27 05:00:43 pihole02 cloudflared[513]: 2023-10-27T05:00:43Z ERR failed to connect to an HTTPS backend "https://1.0.0.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.0.0.1/dns-query\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)"
Oct 27 05:00:43 pihole02 cloudflared[513]: 2023-10-27T05:00:43Z ERR failed to connect to an HTTPS backend "https://1.0.0.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.0.0.1/dns-query\": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)"
Oct 27 05:00:43 pihole02 cloudflared[513]: 2023-10-27T05:00:43Z ERR failed to connect to an HTTPS backend "https://1.0.0.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.0.0.1/dns-query\": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)"
Oct 27 05:00:43 pihole02 cloudflared[513]: 2023-10-27T05:00:43Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.1.1.1/dns-query\": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)"
Oct 27 05:00:43 pihole02 cloudflared[513]: 2023-10-27T05:00:43Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.1.1.1/dns-query\": context deadline exceeded"
Oct 27 05:00:43 pihole02 cloudflared[513]: 2023-10-27T05:00:43Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.1.1.1/dns-query\": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)"
Oct 27 05:00:43 pihole02 cloudflared[513]: 2023-10-27T05:00:43Z ERR failed to connect to an HTTPS backend "https://1.0.0.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.0.0.1/dns-query\": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)"
Oct 27 05:00:43 pihole02 cloudflared[513]: 2023-10-27T05:00:43Z ERR failed to connect to an HTTPS backend "https://1.0.0.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.0.0.1/dns-query\": context deadline exceeded"
Oct 27 05:00:43 pihole02 cloudflared[513]: 2023-10-27T05:00:43Z ERR failed to connect to an HTTPS backend "https://1.0.0.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.0.0.1/dns-query\": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)"
Oct 27 05:00:43 pihole02 cloudflared[513]: 2023-10-27T05:00:43Z ERR failed to connect to an HTTPS backend "https://1.0.0.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.0.0.1/dns-query\": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)"
Oct 27 05:00:43 pihole02 cloudflared[513]: 2023-10-27T05:00:43Z ERR failed to connect to an HTTPS backend "https://1.0.0.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.0.0.1/dns-query\": dial tcp 1.0.0.1:443: i/o timeout"
Oct 27 05:00:43 pihole02 cloudflared[513]: 2023-10-27T05:00:43Z ERR failed to connect to an HTTPS backend "https://1.0.0.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.0.0.1/dns-query\": dial tcp 1.0.0.1:443: i/o timeout"
Oct 27 05:00:43 pihole02 cloudflared[513]: 2023-10-27T05:00:43Z ERR failed to connect to an HTTPS backend "https://1.0.0.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.0.0.1/dns-query\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)"
Oct 27 05:00:44 pihole02 cloudflared[513]: 2023-10-27T05:00:44Z ERR failed to connect to an HTTPS backend "https://1.0.0.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.0.0.1/dns-query\": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)"
Oct 27 05:00:44 pihole02 cloudflared[513]: 2023-10-27T05:00:44Z ERR failed to connect to an HTTPS backend "https://1.0.0.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.0.0.1/dns-query\": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)"
Oct 27 05:00:44 pihole02 cloudflared[513]: 2023-10-27T05:00:44Z ERR failed to connect to an HTTPS backend "https://1.0.0.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.0.0.1/dns-query\": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)"
Oct 27 05:00:44 pihole02 cloudflared[513]: 2023-10-27T05:00:44Z ERR failed to connect to an HTTPS backend "https://1.0.0.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.0.0.1/dns-query\": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)"
Oct 27 05:00:44 pihole02 cloudflared[513]: 2023-10-27T05:00:44Z ERR failed to connect to an HTTPS backend "https://1.0.0.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.0.0.1/dns-query\": dial tcp 1.0.0.1:443: i/o timeout"
Oct 27 05:00:44 pihole02 cloudflared[513]: 2023-10-27T05:00:44Z ERR failed to connect to an HTTPS backend "https://1.0.0.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.0.0.1/dns-query\": context deadline exceeded"
Oct 27 05:00:44 pihole02 cloudflared[513]: 2023-10-27T05:00:44Z ERR failed to connect to an HTTPS backend "https://1.0.0.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.0.0.1/dns-query\": context deadline exceeded"
Oct 27 05:00:44 pihole02 cloudflared[513]: 2023-10-27T05:00:44Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.1.1.1/dns-query\": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)"
Oct 27 05:00:44 pihole02 cloudflared[513]: 2023-10-27T05:00:44Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.1.1.1/dns-query\": dial tcp 1.1.1.1:443: i/o timeout"
Oct 27 05:00:44 pihole02 cloudflared[513]: 2023-10-27T05:00:44Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.1.1.1/dns-query\": dial tcp 1.1.1.1:443: i/o timeout"
Oct 27 05:00:44 pihole02 cloudflared[513]: 2023-10-27T05:00:44Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.1.1.1/dns-query\": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)"
...

Only a restart helps. What can we do?

@KLEPTOROTH
Copy link

KLEPTOROTH commented Oct 27, 2023

The problem still exists in 2023.8.2. Tonight we have a internet disconnect of 10 minutes. After reconnecting all DNS queries not working. We are using PiHole with cloudflared.

The message in the logs are

...
Oct 27 05:00:42 pihole02 cloudflared[513]: 2023-10-27T05:00:42Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.1.1.1/dns-query\": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)"
Oct 27 05:00:42 pihole02 cloudflared[513]: 2023-10-27T05:00:42Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.1.1.1/dns-query\": context deadline exceeded"
Oct 27 05:00:42 pihole02 cloudflared[513]: 2023-10-27T05:00:42Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.1.1.1/dns-query\": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)"
Oct 27 05:00:42 pihole02 cloudflared[513]: 2023-10-27T05:00:42Z ERR failed to connect to an HTTPS backend "https://1.0.0.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.0.0.1/dns-query\": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)"
Oct 27 05:00:43 pihole02 cloudflared[513]: 2023-10-27T05:00:43Z ERR failed to connect to an HTTPS backend "https://1.0.0.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.0.0.1/dns-query\": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)"
Oct 27 05:00:43 pihole02 cloudflared[513]: 2023-10-27T05:00:43Z ERR failed to connect to an HTTPS backend "https://1.0.0.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.0.0.1/dns-query\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)"
Oct 27 05:00:43 pihole02 cloudflared[513]: 2023-10-27T05:00:43Z ERR failed to connect to an HTTPS backend "https://1.0.0.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.0.0.1/dns-query\": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)"
Oct 27 05:00:43 pihole02 cloudflared[513]: 2023-10-27T05:00:43Z ERR failed to connect to an HTTPS backend "https://1.0.0.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.0.0.1/dns-query\": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)"
Oct 27 05:00:43 pihole02 cloudflared[513]: 2023-10-27T05:00:43Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.1.1.1/dns-query\": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)"
Oct 27 05:00:43 pihole02 cloudflared[513]: 2023-10-27T05:00:43Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.1.1.1/dns-query\": context deadline exceeded"
Oct 27 05:00:43 pihole02 cloudflared[513]: 2023-10-27T05:00:43Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.1.1.1/dns-query\": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)"
Oct 27 05:00:43 pihole02 cloudflared[513]: 2023-10-27T05:00:43Z ERR failed to connect to an HTTPS backend "https://1.0.0.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.0.0.1/dns-query\": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)"
Oct 27 05:00:43 pihole02 cloudflared[513]: 2023-10-27T05:00:43Z ERR failed to connect to an HTTPS backend "https://1.0.0.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.0.0.1/dns-query\": context deadline exceeded"
Oct 27 05:00:43 pihole02 cloudflared[513]: 2023-10-27T05:00:43Z ERR failed to connect to an HTTPS backend "https://1.0.0.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.0.0.1/dns-query\": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)"
Oct 27 05:00:43 pihole02 cloudflared[513]: 2023-10-27T05:00:43Z ERR failed to connect to an HTTPS backend "https://1.0.0.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.0.0.1/dns-query\": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)"
Oct 27 05:00:43 pihole02 cloudflared[513]: 2023-10-27T05:00:43Z ERR failed to connect to an HTTPS backend "https://1.0.0.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.0.0.1/dns-query\": dial tcp 1.0.0.1:443: i/o timeout"
Oct 27 05:00:43 pihole02 cloudflared[513]: 2023-10-27T05:00:43Z ERR failed to connect to an HTTPS backend "https://1.0.0.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.0.0.1/dns-query\": dial tcp 1.0.0.1:443: i/o timeout"
Oct 27 05:00:43 pihole02 cloudflared[513]: 2023-10-27T05:00:43Z ERR failed to connect to an HTTPS backend "https://1.0.0.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.0.0.1/dns-query\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)"
Oct 27 05:00:44 pihole02 cloudflared[513]: 2023-10-27T05:00:44Z ERR failed to connect to an HTTPS backend "https://1.0.0.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.0.0.1/dns-query\": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)"
Oct 27 05:00:44 pihole02 cloudflared[513]: 2023-10-27T05:00:44Z ERR failed to connect to an HTTPS backend "https://1.0.0.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.0.0.1/dns-query\": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)"
Oct 27 05:00:44 pihole02 cloudflared[513]: 2023-10-27T05:00:44Z ERR failed to connect to an HTTPS backend "https://1.0.0.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.0.0.1/dns-query\": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)"
Oct 27 05:00:44 pihole02 cloudflared[513]: 2023-10-27T05:00:44Z ERR failed to connect to an HTTPS backend "https://1.0.0.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.0.0.1/dns-query\": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)"
Oct 27 05:00:44 pihole02 cloudflared[513]: 2023-10-27T05:00:44Z ERR failed to connect to an HTTPS backend "https://1.0.0.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.0.0.1/dns-query\": dial tcp 1.0.0.1:443: i/o timeout"
Oct 27 05:00:44 pihole02 cloudflared[513]: 2023-10-27T05:00:44Z ERR failed to connect to an HTTPS backend "https://1.0.0.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.0.0.1/dns-query\": context deadline exceeded"
Oct 27 05:00:44 pihole02 cloudflared[513]: 2023-10-27T05:00:44Z ERR failed to connect to an HTTPS backend "https://1.0.0.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.0.0.1/dns-query\": context deadline exceeded"
Oct 27 05:00:44 pihole02 cloudflared[513]: 2023-10-27T05:00:44Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.1.1.1/dns-query\": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)"
Oct 27 05:00:44 pihole02 cloudflared[513]: 2023-10-27T05:00:44Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.1.1.1/dns-query\": dial tcp 1.1.1.1:443: i/o timeout"
Oct 27 05:00:44 pihole02 cloudflared[513]: 2023-10-27T05:00:44Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.1.1.1/dns-query\": dial tcp 1.1.1.1:443: i/o timeout"
Oct 27 05:00:44 pihole02 cloudflared[513]: 2023-10-27T05:00:44Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.1.1.1/dns-query\": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)"
...

Only a restart helps. What can we do?

Give up on cloudflared. Just use dnscrypt. I set it up over a year and a half ago and haven't touched it since. This issue has been open since 2021, even if it ever does get resolved, it's not worth the wait when dnscrypt works perfectly and is rock solid stable.

@FabioEight
Copy link

Issues is still present.

2024-05-06T12:43:07Z ERR Unable to establish connection with Cloudflare edge error="DialContext error: dial tcp 192.168.1.1:7844: connect: connection refused" connIndex=0 event=0 ip=192.168.1.1
2024-05-06T12:43:07Z ERR Serve tunnel error error="DialContext error: dial tcp 192.168.1.1:7844: connect: connection refused" connIndex=0 event=0 ip=192.168.1.1
2024-05-06T12:43:07Z INF Retrying connection in up to 17m4s connIndex=0 event=0 ip=192.168.1.1
2024-05-06T12:44:43Z ERR Unable to establish connection with Cloudflare edge error="DialContext error: dial tcp 192.168.1.1:7844: connect: connection refused" connIndex=0 event=0 ip=192.168.1.1
2024-05-06T12:44:43Z ERR Serve tunnel error error="DialContext error: dial tcp 192.168.1.1:7844: connect: connection refused" connIndex=0 event=0 ip=192.168.1.1
2024-05-06T12:44:43Z INF Retrying connection in up to 34m8s connIndex=0 event=0 ip=192.168.1.1
2024-05-06T13:16:31Z ERR Unable to establish connection with Cloudflare edge error="DialContext error: dial tcp 192.168.1.1:7844: connect: connection refused" connIndex=0 event=0 ip=192.168.1.1
2024-05-06T13:16:31Z ERR Serve tunnel error error="DialContext error: dial tcp 192.168.1.1:7844: connect: connection refused" connIndex=0 event=0 ip=192.168.1.1
2024-05-06T13:16:31Z INF Retrying connection in up to 1h8m16s connIndex=0 event=0 ip=192.168.1.1
2024-05-06T14:06:01Z ERR Unable to establish connection with Cloudflare edge error="DialContext error: dial tcp 192.168.1.1:7844: connect: connection refused" connIndex=0 event=0 ip=192.168.1.1
2024-05-06T14:06:01Z ERR Serve tunnel error error="DialContext error: dial tcp 192.168.1.1:7844: connect: connection refused" connIndex=0 event=0 ip=192.168.1.1](url)

@sangwe11
Copy link

2024-05-26T10:03:01Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.1.1.1/dns-query\": context deadline exceeded"
2024-05-26T10:03:01Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.1.1.1/dns-query\": context deadline exceeded"
2024-05-26T10:03:01Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform an HTTPS request: Post \"https://1.1.1.1/dns-query\": net/http: request canceled (Client.Timeout exceeded while awaiting headers)"

Issue is still present as of 2024.5.0.

cloudflared version 2024.5.0 (built 2024-05-16-1621 UTC)

@kamalmjt
Copy link

I have same problem if connection lost cloudflare dns proxy not recovery.

Jun 10 15:09:20 dns02 cloudflared[276]: 2024-06-10T13:09:20Z ERR failed to connect to an HTTPS backend "https://1.0.0.1/dns-query" error="failed to perform an HTTPS request: Post "https://1.0.0.1/dns-query\": net/http: request canceled (Client.Timeout exceeded while awaiting head>
Jun 10 15:09:20 dns02 cloudflared[276]: 2024-06-10T13:09:20Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform an HTTPS request: Post "https://1.1.1.1/dns-query\": net/http: request canceled (Client.Timeout exceeded while awaiting head>
Jun 10 15:09:21 dns02 cloudflared[276]: 2024-06-10T13:09:21Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform an HTTPS request: Post "https://1.1.1.1/dns-query\": net/http: request canceled (Client.Timeout exceeded while awaiting head>
Jun 10 15:09:22 dns02 cloudflared[276]: 2024-06-10T13:09:22Z ERR failed to connect to an HTTPS backend "https://1.0.0.1/dns-query" error="failed to perform an HTTPS request: Post "https://1.0.0.1/dns-query\": net/http: request canceled (Client.Timeout exceeded while awaiting head>
Jun 10 15:09:23 dns02 cloudflared[276]: 2024-06-10T13:09:23Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform an HTTPS request: Post "https://1.1.1.1/dns-query\": net/http: request canceled (Client.Timeout exceeded while awaiting head>
Jun 10 15:09:24 dns02 cloudflared[276]: 2024-06-10T13:09:24Z ERR failed to connect to an HTTPS backend "https://1.0.0.1/dns-query" error="failed to perform an HTTPS request: Post "https://1.0.0.1/dns-query\": net/http: request canceled (Client.Timeout exceeded while awaiting head>
Jun 10 15:09:25 dns02 cloudflared[276]: 2024-06-10T13:09:25Z ERR failed to connect to an HTTPS backend "https://1.1.1.1/dns-query" error="failed to perform an HTTPS request: Post "https://1.1.1.1/dns-query\": net/http: request canceled (Client.Timeout exceeded while awaiting head>
Jun 10 15:09:25 dns02 cloudflared[276]: 2024-06-10T13:09:25Z ERR failed to connect to an HTTPS backend "https://1.0.0.1/dns-query" error="failed to perform an HTTPS request: Post "https://1.0.0.1/dns-query\": net/http: request canceled (Client.Timeout exceeded while awaiting head>
Jun 10 15:09:26 dns02 cloudflared[276]: 2024-06-10T13:09:26Z ERR failed to connect to an HTTPS backend "https://1.0.0.1/dns-query" error="failed to perform an HTTPS request: Post "https://1.0.0.1/dns-query\": net/http: request canceled (Client.Timeout exceeded while awaiting head>
J

@FabioEight
Copy link

As workaround, I'm using webhookd via Uptime Kuma alert trigger to restart cloudflared process each time internet connectivity is lost/recovered.

@sladg
Copy link

sladg commented Aug 4, 2024

Experiencing same on Debian (LXC), version 2024.6.1.
If internet goes down for a bit while container keeps running, cloudflare will disconnect and won't connect back again once online.

@InoryS
Copy link

InoryS commented Aug 18, 2024

I encountered a situation where when the network was interrupted and restored, there was no response in the cloudflared log.
At this time, when I visited the tunnel website, I got Error 1033 2024-08-18 09:44:14 UTC Argo Tunnel error.
Unless I executed systemctl restart cloudflared, the connection would not be restored.
It seemed like cloudflared did not detect that the connection was interrupted.

# cloudflared -v
cloudflared version 2024.8.2 (built 2024-08-06-1219 UTC)
# systemctl status cloudflared
8 18 17:35:45 systemd[1]: Started cloudflared.
8 18 17:35:45 cloudflared[2118758]: 2024-08-18T09:35:45Z INF Registered tunnel connection connIndex=1 connection= event=0 ip=198.41.192.47 location=hkg09 protocol=http2
8 18 17:35:46 cloudflared[2118758]: 2024-08-18T09:35:46Z INF Registered tunnel connection connIndex=2 connection= event=0 ip=198.41.192.7 location=hkg09 protocol=http2
8 18 17:35:47 cloudflared[2118758]: 2024-08-18T09:35:47Z INF Registered tunnel connection connIndex=3 connection= event=0 ip=198.41.200.233 location=hkg10 protocol=http2
8 18 17:35:48 cloudflared[2118758]: 2024-08-18T09:35:48Z INF Updated to new configuration config=

↑ This remains the case 20 minutes after the network connection is disconnected and restored.

So I had to write a simple python script to manually perform health checks and restart cloudflared.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: DNS-Proxy Issues related to DNS-Proxy functionality in cloudflared Priority: Deferred Issue has been placed in backlog
Projects
None yet
Development

No branches or pull requests