Caddy has been sending requests

1. Version 2.4.6

2. How I run Caddy:

a. System environment:

ubuntu 18.04
no docker

b. Command

systemctl start caddy.service

c. Caddyfile

mydomainname {
   reverse_proxy 127.0.0.1:19988

   log {
    output file /var/log/caddy/access.log
   }
}

3. The problem I’m having:

According to the logs, it can be observed that there are hundreds of requests in 1 minute, and I don’t know why

4. Error messages

status caddy


server’slog

{"level":"error","ts":1643879594267802,"logger":"http.log.error.log0","msg":"EOF","request":{"remote_addr":"ip:port","proto":"HTTP / 1.1","method":"GE T","ho st":"x xx","u ri": " ","he a  dedrs":{"Connectdion":["Updgrade"],"Pragdma":["no-cache"],"Cache-Control":["no-cache"],"Upgrade":["websodcket"],"Sec-W ebsdocket-Version"::["13"],"Sec-Wdebsocket-Key":["sJ="],"Sec-Websocket-Extensions":["; client_max_window_bits"],"User-Agent":["*"],"Origin":["url"],"Accept-Encoding":["gzip, deflate, br"],"Accept-Language":["en-US,en;q=0.9,el;q=0.8,fr;q=0.7"]},"tls":{"resumed":false,"version":772,"cipher_suite":4865,"proto":"","proto_mutual":true,"server_name":"uri"}},"duration":0.000359377,"status":502,"err_id":"vf32r9","err_trace":"reverseproxy.statusError (reverseproxy.go:886)"}

Looks like your upstream app ran out of available connections. You’ll probably need to make some tweaks to allow more connections. I don’t think this is a problem with Caddy.

You’ll need to dig deeper into your upstream app, where the problem seems to lie.

Thank you very much,I have another question as to why caddy is reporting the following error, I have a similarly configured environment, but it works properly

{"level":"error","ts":1643879594267802,"logger":"http.log.error.log0","msg":"EOF","request":{"remote_addr":"ip:port","proto":"HTTP / 1.1","method":"GE T","ho st":"x xx","u ri": " ","he a  dedrs":{"Connectdion":["Updgrade"],"Pragdma":["no-cache"],"Cache-Control":["no-cache"],"Upgrade":["websodcket"],"Sec-W ebsdocket-Version"::["13"],"Sec-Wdebsocket-Key":["sJ="],"Sec-Websocket-Extensions":["; client_max_window_bits"],"User-Agent":["*"],"Origin":["url"],"Accept-Encoding":["gzip, deflate, br"],"Accept-Language":["en-US,en;q=0.9,el;q=0.8,fr;q=0.7"]},"tls":{"resumed":false,"version":772,"cipher_suite":4865,"proto":"","proto_mutual":true,"server_name":"uri"}},"duration":0.000359377,"status":502,"err_id":"vf32r9","err_trace":"reverseproxy.statusError (reverseproxy.go:886)"}

EOF just means “Caddy wasn’t able to read a response from upstream”. This means the upstream closed the connection before Caddy was able to receive a response and it ran out of bytes to read when it was expecting more.

1 Like

thank you,
It didn’t seem like caddy’s problem, and I dug into it

What this sentence says?

dial tcp: lookup 3s on 127.0.0.1:53: read udp 127.0.0.1:54508->127.0.0.1:53: read: connection refused
dial tcp: lookup ip_hash on 127.0.0.1:53: read udp 127.0.0.1:40466->127.0.0.1:53: read: connection refused
dial tcp: lookup 400: no such host

That means Caddy wasn’t able to resolve DNS for domains named 3s, ip_hash or 400.

I think you made a configuration mistake, but you didn’t share your config so I can’t really suggest anything. Make sure you used the right syntax for reverse_proxy.

1 Like
mydomainname {
   reverse_proxy 127.0.0.1:19988
{
       lb_policy ip_hash
       health_path /
       health_status 400
       health_interval 5s
       health_timeout 3s
   }

   log {
    output file /var/log/caddy/access.log
   }
}

Make sure your { is on the same line as the directive it pairs with. Syntax is important.

Also, using lb_policy and active health checks won’t give you much benefit if you only have a single upstream. The benefits of those are when you have multiple upstreams that you need to load balance between.

2 Likes

This topic was automatically closed after 29 days. New replies are no longer allowed.