Load API endpoint timeouts

1. The problem I’m having:

When adding new reverse proxy domains with automatic HTTPS, posting the updated config via the localhost:2019/load API endpoint often times out.

Separately, if I restart (via systemd) CaddyServer, the load endpoint will work for a few days before beginning to fail again.

Side note and extra credit issue: Restarting Caddy causes SSL negotiation errors for about ~5 minutes so I try to avoid.

2. Error messages and/or full log output:

-----> Command failed: curl --max-time 15 -s --fail-with-body -X POST -H 'Content-Type: application/json' localhost:2019/load --data '{"apps":{"http":{"servers":{"srv0":{"listen":[":443",":80"],"routes":[{"handle":[{"handler":"subroute","routes":[{"handle":[{"handler":"headers","request":{"add":{"X-Request-Start":["{time.now.unix_ms}"]}}},{"handler":"vars","root":"/home/deploy/pwpush-x/current/public"},{"handler":"encode","encodings":{"gzip":{},"zstd":{}}}]},{"handle":[{"handler":"static_response","status_code":"200","body":"User-agent: *\nDisallow: /"}],"match":[{"host":["6nm8v.hatchboxapp.com"],"path":["/robots.txt"]}],"terminal":true},{"handle":[{"handler":"headers","response":{"set":{"Cache-Control":["max-age=31536000"]}}}],"match":[{"path":["/assets/*","/packs/*"]}]},{"handle":[{"handler":"reverse_proxy","upstreams":[{"dial":"127.0.0.1:9000"}],"trusted_proxies":["173.245.48.0/20","103.21.244.0/22","103.22.200.0/22","103.31.4.0/22","141.101.64.0/18","108.162.192.0/18","190.93.240.0/20","188.114.96.0/20","197.234.240.0/22","198.41.128.0/17","162.158.0.0/15","104.16.0.0/13","104.24.0.0/14","172.64.0.0/13","131.0.72.0/22","2400:cb00::/32","2606:4700::/32","2803:f800::/32","2405:b500::/32","2405:8100::/32","2a06:98c0::/29","2c0f:f248::/32"]}],"match":[{"not":[{"file":{"try_files":["{http.request.uri.path}","{http.request.uri.path}/index.html"]}}]}]},{"handle":[{"handler":"file_server"}]}]}],"match":[{"host":["pwp.domain1.net","passwordpush.domain2.com","note.domain3.k12.or.us","pwp.domain4.com","pwp.domain5.com","passwords.domain6.com","pwp.domain7.com","pass.domain8.cz","push.domain9.co.uk","pwp.domain10.com","pwp.domain11.com","pwp.domain12.com","pw.domain13.xyz","pwp.domain14.com","pwpush.domain15.com","pwp.domain16.com","push.domain17.net","pwpush.domain18.com","pwp.domain19.edu.au","domain20.com","www.domain20.com","pwp.domain21.tech","send.domain22.com","pwp.domain23.com","6nm8v.hatchboxapp.com","167.71.6.178","10.110.0.4"]}],"terminal":true},{"handle":[{"handler":"subroute","routes":[{"handle":[{"handler":"headers","request":{"add":{"X-Request-Start":["{time.now.unix_ms}"]}}},{"handler":"vars","root":"/home/deploy/domain16-com/current/public"},{"handler":"encode","encodings":{"gzip":{},"zstd":{}}}]},{"handle":[{"handler":"static_response","status_code":"200","body":"User-agent: *\nDisallow: /"}],"match":[{"host":["y5o3e.hatchboxapp.com"],"path":["/robots.txt"]}],"terminal":true},{"handle":[{"handler":"headers","response":{"set":{"Cache-Control":["max-age=31536000"]}}}],"match":[{"path":["/assets/*","/packs/*"]}]},{"handle":[{"handler":"reverse_proxy","upstreams":[{"dial":"127.0.0.1:9020"}],"trusted_proxies":["173.245.48.0/20","103.21.244.0/22","103.22.200.0/22","103.31.4.0/22","141.101.64.0/18","108.162.192.0/18","190.93.240.0/20","188.114.96.0/20","197.234.240.0/22","198.41.128.0/17","162.158.0.0/15","104.16.0.0/13","104.24.0.0/14","172.64.0.0/13","131.0.72.0/22","2400:cb00::/32","2606:4700::/32","2803:f800::/32","2405:b500::/32","2405:8100::/32","2a06:98c0::/29","2c0f:f248::/32"]}],"match":[{"not":[{"file":{"try_files":["{http.request.uri.path}","{http.request.uri.path}/index.html"]}}]}]},{"handle":[{"handler":"file_server"}]}]}],"match":[{"host":["www.domain16.com","domain16.com","y5o3e.hatchboxapp.com","167.71.6.178","10.110.0.4"]}],"terminal":true},{"handle":[{"handler":"subroute","routes":[{"handle":[{"handler":"headers","request":{"add":{"X-Request-Start":["{time.now.unix_ms}"]}}},{"handler":"vars","root":"/home/deploy/pwpush-oss/current/public"},{"handler":"encode","encodings":{"gzip":{},"zstd":{}}}]},{"handle":[{"handler":"static_response","status_code":"200","body":"User-agent: *\nDisallow: /"}],"match":[{"host":["ydpkq.hatchboxapp.com"],"path":["/robots.txt"]}],"terminal":true},{"handle":[{"handler":"headers","response":{"set":{"Cache-Control":["max-age=31536000"]}}}],"match":[{"path":["/assets/*","/packs/*"]}]},{"handle":[{"handler":"reverse_proxy","upstreams":[{"dial":"127.0.0.1:9030"}],"trusted_proxies":["173.245.48.0/20","103.21.244.0/22","103.22.200.0/22","103.31.4.0/22","141.101.64.0/18","108.162.192.0/18","190.93.240.0/20","188.114.96.0/20","197.234.240.0/22","198.41.128.0/17","162.158.0.0/15","104.16.0.0/13","104.24.0.0/14","172.64.0.0/13","131.0.72.0/22","2400:cb00::/32","2606:4700::/32","2803:f800::/32","2405:b500::/32","2405:8100::/32","2a06:98c0::/29","2c0f:f248::/32"]}],"match":[{"not":[{"file":{"try_files":["{http.request.uri.path}","{http.request.uri.path}/index.html"]}}]}]},{"handle":[{"handler":"file_server"}]}]}],"match":[{"host":["oss.domain20.com","ydpkq.hatchboxapp.com","167.71.6.178","10.110.0.4"]}],"terminal":true},{"handle":[{"handler":"subroute","routes":[{"handle":[{"handler":"headers","request":{"add":{"X-Request-Start":["{time.now.unix_ms}"]}}},{"handler":"vars","root":"/home/deploy/docs/current/public"},{"handler":"encode","encodings":{"gzip":{},"zstd":{}}}]},{"handle":[{"handler":"static_response","status_code":"200","body":"User-agent: *\nDisallow: /"}],"match":[{"host":["6weg5.hatchboxapp.com"],"path":["/robots.txt"]}],"terminal":true},{"handle":[{"handler":"headers","response":{"set":{"Cache-Control":["max-age=31536000"]}}}],"match":[{"path":["/assets/*","/packs/*"]}]},{"handle":[{"handler":"reverse_proxy","upstreams":[{"dial":"127.0.0.1:9010"}],"trusted_proxies":["173.245.48.0/20","103.21.244.0/22","103.22.200.0/22","103.31.4.0/22","141.101.64.0/18","108.162.192.0/18","190.93.240.0/20","188.114.96.0/20","197.234.240.0/22","198.41.128.0/17","162.158.0.0/15","104.16.0.0/13","104.24.0.0/14","172.64.0.0/13","131.0.72.0/22","2400:cb00::/32","2606:4700::/32","2803:f800::/32","2405:b500::/32","2405:8100::/32","2a06:98c0::/29","2c0f:f248::/32"]}],"match":[{"not":[{"file":{"try_files":["{http.request.uri.path}","{http.request.uri.path}/index.html"]}}]}]},{"handle":[{"handler":"file_server"}]}]}],"match":[{"host":["docs.domain20.com","6weg5.hatchboxapp.com","167.71.6.178","10.110.0.4"]}],"terminal":true}],"errors":{"routes":[{"match":[{"host":["pwp.domain1.net","passwordpush.domain2.com","note.domain3.k12.or.us","pwp.domain4.com","pwp.domain5.com","passwords.domain6.com","pwp.domain7.com","pass.domain8.cz","push.domain9.co.uk","pwp.domain10.com","pwp.domain11.com","pwp.domain12.com","pw.domain13.xyz","pwp.domain14.com","pwpush.domain15.com","pwp.domain16.com","push.domain17.net","pwpush.domain18.com","pwp.domain19.edu.au","domain20.com","www.domain20.com","pwp.domain21.tech","send.domain22.com","pwp.domain23.com","www.domain16.com","domain16.com","oss.domain20.com","docs.domain20.com","6nm8v.hatchboxapp.com","y5o3e.hatchboxapp.com","ydpkq.hatchboxapp.com","6weg5.hatchboxapp.com"]}],"handle":[{"handler":"subroute","routes":[{"handle":[{"handler":"headers","response":{"add":{"Cache-Control":["no-cache"],"expires":["0"]}}}]},{"handle":[{"handler":"vars","root":"/home/deploy/.hatchbox/templates"}]},{"handle":[{"handler":"rewrite","uri":"/error.html"}]},{"handle":[{"handler":"file_server"}]}]}],"terminal":true}]},"tls_connection_policies":[{}],"logs":{}}}},"tls":{"automation":{"policies":[{"subjects": ["6nm8v.hatchboxapp.com", "pwp.domain1.net", "passwordpush.domain2.com", "note.domain3.k12.or.us", "pwp.domain4.com", "pwp.domain5.com", "passwords.domain6.com", "pwp.domain7.com", "pass.domain8.cz", "push.domain9.co.uk", "pwp.domain10.com", "pwp.domain11.com", "pwp.domain12.com", "pw.domain13.xyz", "pwp.domain14.com", "pwpush.domain15.com", "pwp.domain16.com", "push.domain17.net", "pwpush.domain18.com", "pwp.domain19.edu.au", "domain20.com", "www.domain20.com", "pwp.domain21.tech", "send.domain22.com", "pwp.domain23.com"] ,"on_demand":true},{"subjects":["y5o3e.hatchboxapp.com","www.domain16.com","domain16.com"],"on_demand":true},{"subjects":["ydpkq.hatchboxapp.com","oss.domain20.com"],"on_demand":true},{"subjects":["6weg5.hatchboxapp.com","docs.domain20.com"],"on_demand":true}],"on_demand":{"rate_limit":{"interval":"2m","burst":5},"ask":"https://app.hatchbox.io/api/v1/caddy/ask"}},"certificates":{"load_files":[]}}}}'
Command returned exit code 28

Notes:

  • Repeated curl attempts also fail
  • If I restart Caddy, it will work again for a few days
  • The site is a fairly high traffic site (800k page views/month)
  • Customer domains replaced with “domainXX”.
  • I can’t enable debug mode because this is a high traffic production site and Hatchbox manages the config loads (we are trying to figure out the issue together)

If I monitor logs while the curl is running I see:

journalctl --unit=caddy -f | grep "admin.api"
Oct 15 21:16:10 T-1000 caddy[2074783]: {"level":"info","ts":1729026970.1773386,"logger":"admin.api","msg":"received request","method":"POST","host":"localhost:2019","uri":"/load","remote_ip":"127.0.0.1","remote_port":"54836","headers":{"Accept":["*/*"],"Content-Length":["7952"],"Content-Type":["application/json"],"User-Agent":["curl/7.81.0"]}}

3. Caddy version:

v2.7.6 h1:w0NymbG2m9PcvKWsrXO6EEkY9Ru4FJK8uQbYcev1p3A

4. How I installed and ran Caddy:

Installed as a systemd service

a. System environment:

  • Ubuntu 22.04.5 LTS (GNU/Linux 5.15.0-119-generic x86_64)
  • A Digital Ocean 4GB (60% utilization) 2 CPU (10% utilization) droplet

b. Command:

systemctl status caddy

● caddy.service - Caddy
     Loaded: loaded (/etc/systemd/system/caddy.service; enabled; vendor preset: enabled)
     Active: active (running) since Sat 2024-10-12 22:07:44 UTC; 2 days ago
       Docs: https://caddyserver.com/docs/
   Main PID: 2074783 (caddy)
      Tasks: 10 (limit: 4647)
     Memory: 105.8M
        CPU: 56min 23.366s
     CGroup: /system.slice/caddy.service
             └─2074783 /usr/bin/caddy run --environ --resume

Oct 15 21:00:05 T-1000 caddy[2074783]: {"level":"info","ts":1729026005.2690575,"logger":"http.log.access","msg":"handled request",>
...

c. Service/unit/compose file:

cat /etc/systemd/system/caddy.service
# caddy-api.service
#
# For using Caddy with its API.
#
# This unit is "durable" in that it will automatically resume
# the last active configuration if the service is restarted.
#
# See https://caddyserver.com/docs/install for instructions.

[Unit]
Description=Caddy
Documentation=https://caddyserver.com/docs/
After=network.target network-online.target
Requires=network-online.target

[Service]
User=deploy
Group=deploy
ExecStart=/usr/bin/caddy run --environ --resume
TimeoutStopSec=5s
LimitNOFILE=1048576
PrivateTmp=true
ProtectSystem=full
AmbientCapabilities=CAP_NET_BIND_SERVICE
Restart=always

[Install]
WantedBy=multi-user.target

d. My complete Caddy config:

{
  "apps": {
    "http": {
      "servers": {
        "srv0": {
          "listen": [
            ":443",
            ":80"
          ],
          "routes": [
            {
              "handle": [
                {
                  "handler": "subroute",
                  "routes": [
                    {
                      "handle": [
                        {
                          "handler": "headers",
                          "request": {
                            "add": {
                              "X-Request-Start": [
                                "{time.now.unix_ms}"
                              ]
                            }
                          }
                        },
                        {
                          "handler": "vars",
                          "root": "/home/deploy/pwpush-x/current/public"
                        },
                        {
                          "handler": "encode",
                          "encodings": {
                            "gzip": {},
                            "zstd": {}
                          }
                        }
                      ]
                    },
                    {
                      "handle": [
                        {
                          "handler": "static_response",
                          "status_code": "200",
                          "body": "User-agent: *\nDisallow: /"
                        }
                      ],
                      "match": [
                        {
                          "host": [
                            "6nm8v.hatchboxapp.com"
                          ],
                          "path": [
                            "/robots.txt"
                          ]
                        }
                      ],
                      "terminal": true
                    },
                    {
                      "handle": [
                        {
                          "handler": "headers",
                          "response": {
                            "set": {
                              "Cache-Control": [
                                "max-age=31536000"
                              ]
                            }
                          }
                        }
                      ],
                      "match": [
                        {
                          "path": [
                            "/assets/*",
                            "/packs/*"
                          ]
                        }
                      ]
                    },
                    {
                      "handle": [
                        {
                          "handler": "reverse_proxy",
                          "upstreams": [
                            {
                              "dial": "127.0.0.1:9000"
                            }
                          ],
                          "trusted_proxies": [
                            "173.245.48.0/20",
                            "103.21.244.0/22",
                            "103.22.200.0/22",
                            "103.31.4.0/22",
                            "141.101.64.0/18",
                            "108.162.192.0/18",
                            "190.93.240.0/20",
                            "188.114.96.0/20",
                            "197.234.240.0/22",
                            "198.41.128.0/17",
                            "162.158.0.0/15",
                            "104.16.0.0/13",
                            "104.24.0.0/14",
                            "172.64.0.0/13",
                            "131.0.72.0/22",
                            "2400:cb00::/32",
                            "2606:4700::/32",
                            "2803:f800::/32",
                            "2405:b500::/32",
                            "2405:8100::/32",
                            "2a06:98c0::/29",
                            "2c0f:f248::/32"
                          ]
                        }
                      ],
                      "match": [
                        {
                          "not": [
                            {
                              "file": {
                                "try_files": [
                                  "{http.request.uri.path}",
                                  "{http.request.uri.path}/index.html"
                                ]
                              }
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "handle": [
                        {
                          "handler": "file_server"
                        }
                      ]
                    }
                  ]
                }
              ],
              "match": [
                {
                  "host": [
                    "pwp.domain1.net",
                    "passwordpush.domain2.com",
                    "note.domain3.k12.or.us",
                    "pwp.domain4.com",
                    "pwp.domain5.com",
                    "passwords.domain6.com",
                    "pwp.domain7.com",
                    "pass.domain8.cz",
                    "push.domain9.co.uk",
                    "pwp.domain10.com",
                    "pwp.domain11.com",
                    "pwp.domain12.com",
                    "pw.domain13.xyz",
                    "pwp.domain14.com",
                    "pwpush.domain15.com",
                    "pwp.domain16.com",
                    "push.domain17.net",
                    "pwpush.domain18.com",
                    "pwp.domain19.edu.au",
                    "domain20.com",
                    "www.domain20.com",
                    "pwp.domain21.tech",
                    "send.domain22.com",
                    "pwp.domain23.com",
                    "6nm8v.hatchboxapp.com",
                    "167.71.6.178",
                    "10.110.0.4"
                  ]
                }
              ],
              "terminal": true
            },
            {
              "handle": [
                {
                  "handler": "subroute",
                  "routes": [
                    {
                      "handle": [
                        {
                          "handler": "headers",
                          "request": {
                            "add": {
                              "X-Request-Start": [
                                "{time.now.unix_ms}"
                              ]
                            }
                          }
                        },
                        {
                          "handler": "vars",
                          "root": "/home/deploy/domain16-com/current/public"
                        },
                        {
                          "handler": "encode",
                          "encodings": {
                            "gzip": {},
                            "zstd": {}
                          }
                        }
                      ]
                    },
                    {
                      "handle": [
                        {
                          "handler": "static_response",
                          "status_code": "200",
                          "body": "User-agent: *\nDisallow: /"
                        }
                      ],
                      "match": [
                        {
                          "host": [
                            "y5o3e.hatchboxapp.com"
                          ],
                          "path": [
                            "/robots.txt"
                          ]
                        }
                      ],
                      "terminal": true
                    },
                    {
                      "handle": [
                        {
                          "handler": "headers",
                          "response": {
                            "set": {
                              "Cache-Control": [
                                "max-age=31536000"
                              ]
                            }
                          }
                        }
                      ],
                      "match": [
                        {
                          "path": [
                            "/assets/*",
                            "/packs/*"
                          ]
                        }
                      ]
                    },
                    {
                      "handle": [
                        {
                          "handler": "reverse_proxy",
                          "upstreams": [
                            {
                              "dial": "127.0.0.1:9020"
                            }
                          ],
                          "trusted_proxies": [
                            "173.245.48.0/20",
                            "103.21.244.0/22",
                            "103.22.200.0/22",
                            "103.31.4.0/22",
                            "141.101.64.0/18",
                            "108.162.192.0/18",
                            "190.93.240.0/20",
                            "188.114.96.0/20",
                            "197.234.240.0/22",
                            "198.41.128.0/17",
                            "162.158.0.0/15",
                            "104.16.0.0/13",
                            "104.24.0.0/14",
                            "172.64.0.0/13",
                            "131.0.72.0/22",
                            "2400:cb00::/32",
                            "2606:4700::/32",
                            "2803:f800::/32",
                            "2405:b500::/32",
                            "2405:8100::/32",
                            "2a06:98c0::/29",
                            "2c0f:f248::/32"
                          ]
                        }
                      ],
                      "match": [
                        {
                          "not": [
                            {
                              "file": {
                                "try_files": [
                                  "{http.request.uri.path}",
                                  "{http.request.uri.path}/index.html"
                                ]
                              }
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "handle": [
                        {
                          "handler": "file_server"
                        }
                      ]
                    }
                  ]
                }
              ],
              "match": [
                {
                  "host": [
                    "www.domain16.com",
                    "domain16.com",
                    "y5o3e.hatchboxapp.com",
                    "167.71.6.178",
                    "10.110.0.4"
                  ]
                }
              ],
              "terminal": true
            },
            {
              "handle": [
                {
                  "handler": "subroute",
                  "routes": [
                    {
                      "handle": [
                        {
                          "handler": "headers",
                          "request": {
                            "add": {
                              "X-Request-Start": [
                                "{time.now.unix_ms}"
                              ]
                            }
                          }
                        },
                        {
                          "handler": "vars",
                          "root": "/home/deploy/pwpush-oss/current/public"
                        },
                        {
                          "handler": "encode",
                          "encodings": {
                            "gzip": {},
                            "zstd": {}
                          }
                        }
                      ]
                    },
                    {
                      "handle": [
                        {
                          "handler": "static_response",
                          "status_code": "200",
                          "body": "User-agent: *\nDisallow: /"
                        }
                      ],
                      "match": [
                        {
                          "host": [
                            "ydpkq.hatchboxapp.com"
                          ],
                          "path": [
                            "/robots.txt"
                          ]
                        }
                      ],
                      "terminal": true
                    },
                    {
                      "handle": [
                        {
                          "handler": "headers",
                          "response": {
                            "set": {
                              "Cache-Control": [
                                "max-age=31536000"
                              ]
                            }
                          }
                        }
                      ],
                      "match": [
                        {
                          "path": [
                            "/assets/*",
                            "/packs/*"
                          ]
                        }
                      ]
                    },
                    {
                      "handle": [
                        {
                          "handler": "reverse_proxy",
                          "upstreams": [
                            {
                              "dial": "127.0.0.1:9030"
                            }
                          ],
                          "trusted_proxies": [
                            "173.245.48.0/20",
                            "103.21.244.0/22",
                            "103.22.200.0/22",
                            "103.31.4.0/22",
                            "141.101.64.0/18",
                            "108.162.192.0/18",
                            "190.93.240.0/20",
                            "188.114.96.0/20",
                            "197.234.240.0/22",
                            "198.41.128.0/17",
                            "162.158.0.0/15",
                            "104.16.0.0/13",
                            "104.24.0.0/14",
                            "172.64.0.0/13",
                            "131.0.72.0/22",
                            "2400:cb00::/32",
                            "2606:4700::/32",
                            "2803:f800::/32",
                            "2405:b500::/32",
                            "2405:8100::/32",
                            "2a06:98c0::/29",
                            "2c0f:f248::/32"
                          ]
                        }
                      ],
                      "match": [
                        {
                          "not": [
                            {
                              "file": {
                                "try_files": [
                                  "{http.request.uri.path}",
                                  "{http.request.uri.path}/index.html"
                                ]
                              }
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "handle": [
                        {
                          "handler": "file_server"
                        }
                      ]
                    }
                  ]
                }
              ],
              "match": [
                {
                  "host": [
                    "oss.domain20.com",
                    "ydpkq.hatchboxapp.com",
                    "167.71.6.178",
                    "10.110.0.4"
                  ]
                }
              ],
              "terminal": true
            },
            {
              "handle": [
                {
                  "handler": "subroute",
                  "routes": [
                    {
                      "handle": [
                        {
                          "handler": "headers",
                          "request": {
                            "add": {
                              "X-Request-Start": [
                                "{time.now.unix_ms}"
                              ]
                            }
                          }
                        },
                        {
                          "handler": "vars",
                          "root": "/home/deploy/docs/current/public"
                        },
                        {
                          "handler": "encode",
                          "encodings": {
                            "gzip": {},
                            "zstd": {}
                          }
                        }
                      ]
                    },
                    {
                      "handle": [
                        {
                          "handler": "static_response",
                          "status_code": "200",
                          "body": "User-agent: *\nDisallow: /"
                        }
                      ],
                      "match": [
                        {
                          "host": [
                            "6weg5.hatchboxapp.com"
                          ],
                          "path": [
                            "/robots.txt"
                          ]
                        }
                      ],
                      "terminal": true
                    },
                    {
                      "handle": [
                        {
                          "handler": "headers",
                          "response": {
                            "set": {
                              "Cache-Control": [
                                "max-age=31536000"
                              ]
                            }
                          }
                        }
                      ],
                      "match": [
                        {
                          "path": [
                            "/assets/*",
                            "/packs/*"
                          ]
                        }
                      ]
                    },
                    {
                      "handle": [
                        {
                          "handler": "reverse_proxy",
                          "upstreams": [
                            {
                              "dial": "127.0.0.1:9010"
                            }
                          ],
                          "trusted_proxies": [
                            "173.245.48.0/20",
                            "103.21.244.0/22",
                            "103.22.200.0/22",
                            "103.31.4.0/22",
                            "141.101.64.0/18",
                            "108.162.192.0/18",
                            "190.93.240.0/20",
                            "188.114.96.0/20",
                            "197.234.240.0/22",
                            "198.41.128.0/17",
                            "162.158.0.0/15",
                            "104.16.0.0/13",
                            "104.24.0.0/14",
                            "172.64.0.0/13",
                            "131.0.72.0/22",
                            "2400:cb00::/32",
                            "2606:4700::/32",
                            "2803:f800::/32",
                            "2405:b500::/32",
                            "2405:8100::/32",
                            "2a06:98c0::/29",
                            "2c0f:f248::/32"
                          ]
                        }
                      ],
                      "match": [
                        {
                          "not": [
                            {
                              "file": {
                                "try_files": [
                                  "{http.request.uri.path}",
                                  "{http.request.uri.path}/index.html"
                                ]
                              }
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "handle": [
                        {
                          "handler": "file_server"
                        }
                      ]
                    }
                  ]
                }
              ],
              "match": [
                {
                  "host": [
                    "docs.domain20.com",
                    "6weg5.hatchboxapp.com",
                    "167.71.6.178",
                    "10.110.0.4"
                  ]
                }
              ],
              "terminal": true
            }
          ],
          "errors": {
            "routes": [
              {
                "match": [
                  {
                    "host": [
                      "pwp.domain1.net",
                      "passwordpush.domain2.com",
                      "note.domain3.k12.or.us",
                      "pwp.domain4.com",
                      "pwp.domain5.com",
                      "passwords.domain6.com",
                      "pwp.domain7.com",
                      "pass.domain8.cz",
                      "push.domain9.co.uk",
                      "pwp.domain10.com",
                      "pwp.domain11.com",
                      "pwp.domain12.com",
                      "pw.domain13.xyz",
                      "pwp.domain14.com",
                      "pwpush.domain15.com",
                      "pwp.domain16.com",
                      "push.domain17.net",
                      "pwpush.domain18.com",
                      "pwp.domain19.edu.au",
                      "domain20.com",
                      "www.domain20.com",
                      "pwp.domain21.tech",
                      "send.domain22.com",
                      "pwp.domain23.com",
                      "www.domain16.com",
                      "domain16.com",
                      "oss.domain20.com",
                      "docs.domain20.com",
                      "6nm8v.hatchboxapp.com",
                      "y5o3e.hatchboxapp.com",
                      "ydpkq.hatchboxapp.com",
                      "6weg5.hatchboxapp.com"
                    ]
                  }
                ],
                "handle": [
                  {
                    "handler": "subroute",
                    "routes": [
                      {
                        "handle": [
                          {
                            "handler": "headers",
                            "response": {
                              "add": {
                                "Cache-Control": [
                                  "no-cache"
                                ],
                                "expires": [
                                  "0"
                                ]
                              }
                            }
                          }
                        ]
                      },
                      {
                        "handle": [
                          {
                            "handler": "vars",
                            "root": "/home/deploy/.hatchbox/templates"
                          }
                        ]
                      },
                      {
                        "handle": [
                          {
                            "handler": "rewrite",
                            "uri": "/error.html"
                          }
                        ]
                      },
                      {
                        "handle": [
                          {
                            "handler": "file_server"
                          }
                        ]
                      }
                    ]
                  }
                ],
                "terminal": true
              }
            ]
          },
          "tls_connection_policies": [
            {}
          ],
          "logs": {}
        }
      }
    },
    "tls": {
      "automation": {
        "policies": [
          {
            "subjects": [
              "6nm8v.hatchboxapp.com",
              "pwp.domain1.net",
              "passwordpush.domain2.com",
              "note.domain3.k12.or.us",
              "pwp.domain4.com",
              "pwp.domain5.com",
              "passwords.domain6.com",
              "pwp.domain7.com",
              "pass.domain8.cz",
              "push.domain9.co.uk",
              "pwp.domain10.com",
              "pwp.domain11.com",
              "pwp.domain12.com",
              "pw.domain13.xyz",
              "pwp.domain14.com",
              "pwpush.domain15.com",
              "pwp.domain16.com",
              "push.domain17.net",
              "pwpush.domain18.com",
              "pwp.domain19.edu.au",
              "domain20.com",
              "www.domain20.com",
              "pwp.domain21.tech",
              "send.domain22.com",
              "pwp.domain23.com"
            ],
            "on_demand": true
          },
          {
            "subjects": [
              "y5o3e.hatchboxapp.com",
              "www.domain16.com",
              "domain16.com"
            ],
            "on_demand": true
          },
          {
            "subjects": [
              "ydpkq.hatchboxapp.com",
              "oss.domain20.com"
            ],
            "on_demand": true
          },
          {
            "subjects": [
              "6weg5.hatchboxapp.com",
              "docs.domain20.com"
            ],
            "on_demand": true
          }
        ],
        "on_demand": {
          "rate_limit": {
            "interval": "2m",
            "burst": 5
          },
          "ask": "https://app.hatchbox.io/api/v1/caddy/ask"
        }
      },
      "certificates": {
        "load_files": []
      }
    }
  }
}```


### 5. Links to relevant resources:
<!-- Optional, but can help get us on the same page quickly. -->

Please use the latest version, v2.8.4

Remove this from your config. It’s being removed in the next version, it doesn’t work correctly at all.

If the domains are known, you don’t need on_demand at all. On-Demand TLS is for domains you don’t know ahead of time.

I don’t see any catch-all HTTP routes in your config (i.e. for when you receive requests from a domain not listed in a host matcher that gets a cert issued on-demand).

1 Like

This was very helpful thanks!

Upgraded to v2.8.4 and followed instructions above. It seems the problem is back.

v2.8.4 h1:q3pe0wpBj1OcHFZ3n/1nl4V4bxBrYoSoab7rL9BMYNk=

Nov 06 08:45:08 T-1000 caddy[3193627]: {“level”:“error”,“ts”:1730882708.0695465,“logger”:“admin”,“msg”:“stopping current admin endpoint”,“error”:“shutting down admin server: context deadline exceeded”}

After this, API endpoint no longer responds - although it logs that requests were received. Those requests hang forever. I waited 5 minutes with a local curl before ^C.

Even dumping the config hangs:

Nov 07 20:00:45 T-1000 caddy[3193627]: {“level”:“info”,“ts”:1731009645.7791867,“logger”:“admin.api”,“msg”:“received request”,“method”:“GET”,“host”:“localhost:2019”,“uri”:“/config/”,“remote_ip”:“127.0.0.1”,“remote_port”:“48944”,“headers”:{“Accept”:[“/”],“User-Agent”:[“curl/7.81.0”]}}

I am posting so this thread doesn’t close. I’ll post back with full config soon.

Can you try different versions until it starts working again? It seems the last time you tried was 2.7.6 but I’m curious what changed between then and now.

1 Like

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