Caddy Timeouts-

1. The problem I’m having:

I am trying to setup timeouts in my caddy configuration file (JSON format) and am not able to get my caddy file to validate.

I am using the documentation found here with little success: Caddy Timeout Documentation

2. Error messages and/or full log output:

I have a small simple caddy file called test.json to demonstrate the issue I am having:

{
    "apps": {
        "http": {
            "servers": {
                "timeouts": {
                    "idle":"30s",
                    "read_body":"10s",
                    "read_header": "15s",
                    "idle": "5m"
                },
                "srv0": {
                    "listen": [":443"],
                    "routes": [
                        {
                            "match": [{
                                "host":["example.com"]
                            }],
                            "handle": ["file_server"]
                        }
                    ],
                    "automatic_https": {
                      "disable_redirects":true
                     }
                 }
              }
           }
    }
}

The timeout section does not pass the caddy validation routine. Here is the command and error I get from the validation:

$ sudo caddy validate --config /etc/caddy/test.json
2025/04/07 17:11:12.239 INFO    using provided configuration    {"config_file": "/etc/caddy/test.json", "config_adapter": ""}
Error: loading http app module: decoding module config: http: json: unknown field "idle"

3. Caddy version:

Here are my versions of Caddy/OS (Caddy is the only software I have installed and running on this server):

jim@caddyrevproxy:/etc/caddy$ caddy version
2.6.2
jim@caddyrevproxy:/etc/caddy$ uname -a
Linux caddyrevproxy 6.8.0-56-generic #58-Ubuntu SMP PREEMPT_DYNAMIC Fri Feb 14 15:33:28 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux

4. How I installed and ran Caddy:

a. System environment:

Here are the commands I ran to install and get caddy running:

sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https curl
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/caddy-stable-archive-keyring.gpg] https://dl.cloudsmith.io/public/caddy/stable/deb/debian all main" | \
  sudo tee /etc/apt/sources.list.d/caddy-stable.list
sudo apt update
sudo apt install -y caddy
sudo systemctl enable caddy      # enable on boot

b. Command:

I have not gotten this far.   Bad config.

c. Service/unit/compose file:

PASTE OVER THIS, BETWEEN THE ``` LINES.
Please use the preview pane to ensure it looks nice.

d. My complete Caddy config:

PASTE OVER THIS, BETWEEN THE ``` LINES.
Please use the preview pane to ensure it looks nice.

5. Links to relevant resources:

You seem to have idle listed twice, but are you maybe looking for these?

apps > http > servers > read_timeout
apps > http > servers > read_header_timeout
apps > http > servers > idle_timeout

That’s Caddyfile format, not JSON.

Also, just a heads-up that version 2.6.2 is getting pretty old.