Configuration Validation Error

1. The problem I’m having:

I am trying to setup remote admin endpoint with cert auth. I am getting a json validation error, when copying the configuration directly from the documentation and editing it for my values.

2. Error messages and/or full log output:

When I issue the command

caddy validate --config caddyconfig.json

I get the following output.

root@caddy1:/etc/caddy# caddy validate --config caddyconfig.json
2025/02/07 20:36:04.937 INFO    using config from file  {"file": "caddyconfig.json"}
Error: config is not valid JSON: invalid character '}' looking for beginning of object key string; did you mean to use a config adapter (the --adapter flag)?

3. Caddy version:

v2.9.1 h1:OEYiZ7DbCzAWVb6TNEkjRcSCRGHVoZsJinoDR/n9oaY=

4. How I installed and ran Caddy:

via ubuntu apt install command listed on the documentation

a. System environment:

Linux caddy1 6.8.0-52-generic #53-Ubuntu SMP PREEMPT_DYNAMIC Sat Jan 11 00:06:25 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux

d. My complete Caddy config:

I am using the json not caddyfile

{
        "admin": {
                "identity": {
                        "identifiers": ["caddy1.vm.local"],
                },
                "remote": {
                        "listen": "1122",
                        "access_control": [{
                                "public_keys": ["blahblah"],
                        }]
                }
        },
}

You have extra commas , where they shouldn’t be

1 Like

Try this:

{
        "admin": {
                "identity": {
                        "identifiers": ["caddy1.vm.local"]
                },
                "remote": {
                        "listen": "1122",
                        "access_control": [{
                                "public_keys": ["blahblah"]
                        }]
                }
        }
}

Compare it with yours. Like @Mohammed90 said, you have extra commas in the wrong places.

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