Problem which require Caddy restart

1. Caddy version (caddy version):

2. How I run Caddy:

a. System environment:

b. Command:

docker-compose up -d

c. Service/unit/compose file:

version: "2.4"

services:
  caddy:
    image: caddy:2.4.6
    container_name: caddy
    restart: always
    environment:
      ACME_AGREE: "true"
    ports:
      - 9934:9934
      - 9945:9945
      - 80:80
      - 443:443
    volumes:
      - ./Caddyfile:/etc/caddy/Caddyfile
      - ./caddy:/root/.caddy

d. My complete Caddyfile or JSON config:

{
	acme_ca https://acme-v02.api.letsencrypt.org/directory
}

abc.xyz.com:9945 { #WebSocket
	reverse_proxy / docker_node:9944
}

abc.xyz.com:9934 { #HTTP
	reverse_proxy / docker_node:9933
}.

3. The problem I’m having:

After couple of days, Caddy stop working and required restarts. But in the next few days, problem happen again.

4. Error messages and/or full log output:

{“level”:“error”,“ts”:1648719023.5534458,“logger”:“http.log.error”,“msg”:“read tcp 172.18.0.3:33724->172.18.0.2:9944: read: connection reset by peer”,“request”:{“remote_addr”:“54.203.31.176:41776”,“proto”:“HTTP/1.1”,“method”:“GET”,“host”:“archive.mainnet.sample.com:9945”,“uri”:"/",“headers”:{“Upgrade”:[“websocket”],“Connection”:[“Upgrade”],“Sec-Websocket-Version”:[“13”],“Sec-Websocket-Key”:[“SVsvz0mpUIYli+n1XkK9dQ==”]},“tls”:{“resumed”:false,“version”:772,“cipher_suite”:4865,“proto”:"",“proto_mutual”:true,“server_name”:“archive.mainnet.sample.com”}},“duration”:0.002754093,“status”:502,“err_id”:“n9br3pkdz”,“err_trace”:“reverseproxy.statusError (reverseproxy.go:886)”}

5. What I already tried:

Just restart

6. Links to relevant resources:

{"level":"error","ts":1648719023.7859907,"logger":"http.log.error","msg":"read tcp 172.18.0.3:33726->172.18.0.2:9944: read: connection reset by peer","request":{"remote_addr":"37.212.200.206:35403","proto":"HTTP/1.1","method":"GET","host":"archive.mainnet.sample.com:9945","uri":"/","headers":{"Sec-Websocket-Extensions":["permessage-deflate; client_max_window_bits"],"User-Agent":["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.83 Safari/537.36"],"Origin":["https://bridge.stage.sample.com"],"Cookie":["_fbp=fb.1.1639132048772.2055291976; _hjSessionUser_2133914=eyJpZCI6IjJjZTgyZDBhLWUxOTAtNWZmYy05ZTRjLTFmMTlmODdkZmQ5NiIsImNyZWF0ZWQiOjE2MzkxMzIwNDg3ODUsImV4aXN0aW5nIjp0cnVlfQ==; ajs_anonymous_id=c85bffc3-e4c9-4f2d-a605-41f72860b465; ajs_user_id=3d9e3bb5-b66d-4667-882c-8b61d4bff430; _ga_X5RJPTWY32=GS1.1.1642872612.4.0.1642872612.0; _hjSessionUser_2788737=eyJpZCI6IjVkMTdiYTM0LTNlMTMtNTVhMi1iYzQxLWFhZDEzMGMxYzcwYiIsImNyZWF0ZWQiOjE2NDM0ODg2OTExMDgsImV4aXN0aW5nIjpmYWxzZX0=; _ga_TXBD1GMTWG=GS1.1.1643488690.5.1.1643488743.0; _ga=GA1.2.1823801517.1639034670; _gid=GA1.2.351917040.1648707973"],"Sec-Websocket-Key":["JTPtSF2N/XR8r10pn9OI3g=="],"Upgrade":["websocket"],"Sec-Websocket-Version":["13"],"Accept-Encoding":["gzip, deflate, br"],"Accept-Language":["en-GB,en-US;q=0.9,en;q=0.8,ru;q=0.7"],"Connection":["Upgrade"],"Pragma":["no-cache"],"Cache-Control":["no-cache"]},"tls":{"resumed":true,"version":772,"cipher_suite":4865,"proto":"","proto_mutual":true,"server_name":"archive.mainnet.sample.com"}},"duration":0.00193091,"status":502,"err_id":"c6f2kts8j","err_trace":"reverseproxy.statusError (reverseproxy.go:886)"}
{"level":"error","ts":1648719024.218841,"logger":"http.log.error","msg":"EOF","request":{"remote_addr":"37.212.200.206:5059","proto":"HTTP/1.1","method":"GET","host":"archive.mainnet.sample.com:9945","uri":"/","headers":{"Upgrade":["websocket"],"Origin":["https://bridge.stage.sample.com"],"Sec-Websocket-Version":["13"],"Connection":["Upgrade"],"Cache-Control":["no-cache"],"User-Agent":["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.83 Safari/537.36"],"Accept-Encoding":["gzip, deflate, br"],"Accept-Language":["en-GB,en-US;q=0.9,en;q=0.8,ru;q=0.7"],"Cookie":["_fbp=fb.1.1639132048772.2055291976; _hjSessionUser_2133914=eyJpZCI6IjJjZTgyZDBhLWUxOTAtNWZmYy05ZTRjLTFmMTlmODdkZmQ5NiIsImNyZWF0ZWQiOjE2MzkxMzIwNDg3ODUsImV4aXN0aW5nIjp0cnVlfQ==; ajs_anonymous_id=c85bffc3-e4c9-4f2d-a605-41f72860b465; ajs_user_id=3d9e3bb5-b66d-4667-882c-8b61d4bff430; _ga_X5RJPTWY32=GS1.1.1642872612.4.0.1642872612.0; _hjSessionUser_2788737=eyJpZCI6IjVkMTdiYTM0LTNlMTMtNTVhMi1iYzQxLWFhZDEzMGMxYzcwYiIsImNyZWF0ZWQiOjE2NDM0ODg2OTExMDgsImV4aXN0aW5nIjpmYWxzZX0=; _ga_TXBD1GMTWG=GS1.1.1643488690.5.1.1643488743.0; _ga=GA1.2.1823801517.1639034670; _gid=GA1.2.351917040.1648707973"],"Sec-Websocket-Key":["/gUeOrEV3QmI6szc6M7iSA=="],"Sec-Websocket-Extensions":["permessage-deflate; client_max_window_bits"],"Pragma":["no-cache"]},"tls":{"resumed":true,"version":772,"cipher_suite":4865,"proto":"","proto_mutual":true,"server_name":"archive.mainnet.sample.com"}},"duration":0.001962682,"status":502,"err_id":"6hq8wp5we","err_trace":"reverseproxy.statusError (reverseproxy.go:886)"}
{"level":"error","ts":1648719024.6430023,"logger":"http.log.error","msg":"read tcp 172.18.0.3:33732->172.18.0.2:9944: read: connection reset by peer","request":{"remote_addr":"37.212.200.206:53012","proto":"HTTP/1.1","method":"GET","host":"archive.mainnet.sample.com:9945","uri":"/","headers":{"Sec-Websocket-Key":["u5Jw7PtW8eq0lwdlX+LHfw=="],"Connection":["Upgrade"],"Pragma":["no-cache"],"User-Agent":["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.83 Safari/537.36"],"Origin":["https://bridge.stage.sample.com"],"Sec-Websocket-Version":["13"],"Cookie":["_fbp=fb.1.1639132048772.2055291976; _hjSessionUser_2133914=eyJpZCI6IjJjZTgyZDBhLWUxOTAtNWZmYy05ZTRjLTFmMTlmODdkZmQ5NiIsImNyZWF0ZWQiOjE2MzkxMzIwNDg3ODUsImV4aXN0aW5nIjp0cnVlfQ==; ajs_anonymous_id=c85bffc3-e4c9-4f2d-a605-41f72860b465; ajs_user_id=3d9e3bb5-b66d-4667-882c-8b61d4bff430; _ga_X5RJPTWY32=GS1.1.1642872612.4.0.1642872612.0; _hjSessionUser_2788737=eyJpZCI6IjVkMTdiYTM0LTNlMTMtNTVhMi1iYzQxLWFhZDEzMGMxYzcwYiIsImNyZWF0ZWQiOjE2NDM0ODg2OTExMDgsImV4aXN0aW5nIjpmYWxzZX0=; _ga_TXBD1GMTWG=GS1.1.1643488690.5.1.1643488743.0; _ga=GA1.2.1823801517.1639034670; _gid=GA1.2.351917040.1648707973"],"Sec-Websocket-Extensions":["permessage-deflate; client_max_window_bits"],"Cache-Control":["no-cache"],"Upgrade":["websocket"],"Accept-Encoding":["gzip, deflate, br"],"Accept-Language":["en-GB,en-US;q=0.9,en;q=0.8,ru;q=0.7"]},"tls":{"resumed":true,"version":772,"cipher_suite":4865,"proto":"","proto_mutual":true,"server_name":"archive.mainnet.sample.com"}},"duration":0.001678482,"status":502,"err_id":"p02x38kpu","err_trace":"reverseproxy.statusError (reverseproxy.go:886)"}
{"level":"error","ts":1648719024.788687,"logger":"http.log.error","msg":"read tcp 172.18.0.3:33734->172.18.0.2:9944: read: connection reset by peer","request":{"remote_addr":"54.203.31.176:36911","proto":"HTTP/1.1","method":"GET","host":"archive.mainnet.sample.com:9945","uri":"/","headers":{"Upgrade":["websocket"],"Connection":["Upgrade"],"Sec-Websocket-Version":["13"],"Sec-Websocket-Key":["c7HM9mcyeChvPM1yn2YNPA=="]},"tls":{"resumed":false,"version":772,"cipher_suite":4865,"proto":"","proto_mutual":true,"server_name":"archive.mainnet.sample.com"}},"duration":0.001837888,"status":502,"err_id":"vnakyqkm9","err_trace":"reverseproxy.statusError (reverseproxy.go:886)"}

You don’t need this since Caddy v2, since now the terms are assumed to be agreed to simply by using Caddy.

You’re using a path matcher here of / which means "match requests to only the path /", which means paths with other requests will not be handled by Caddy. For example, a request to /foo will not be matched by /.

Remove the / to match all requests in that site block.

Pretty sure this just means the client (browser) closed the connection. That’s not a problem with Caddy.

2 Likes

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