caddyserver / caddy

Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS
https://caddyserver.com
Apache License 2.0
58.12k stars 4.03k forks source link

automatic_https `"disable"` is an unknown field #6552

Closed ZelphirKaltstahl closed 2 months ago

ZelphirKaltstahl commented 2 months ago

I am using the caddy:2.8.4 docker image and I have a JSON file as configuration:

{
    "apps": {
        "http": {
            "http_port": 5000,
            "servers": {
                "automatic_https": {
                    "disable": true
                },
...

I start Caddy using the command:

caddy run --config /config/config.json

(Actually this is specified in a docker compose file as a "command" value:)

    command: [
      "caddy",
      "run",
      "--config",
      "{{website_webserver_service_config_docker_mount_point}}/config.json"
    ]

It does find that config file, all fine, but when starting it tells me:

website  | Error: loading initial config: loading new config: loading http app module: decoding module config: http: json: unknown field "disable"

Which is strange, since it is mentioned in the docs:

https://caddyserver.com/docs/json/apps/http/servers/automatic_https/:

image

Is this a bug? Or is the "disable' key too new for my Caddy image/version?

Background: I am already doing TLS and TLS termination in front of Caddy using a Traefik reverse proxy. I don't need or want Caddy doing any HTTPS stuff, unless necessary, which I currently think it is not for my setup.

mohammed90 commented 2 months ago

You don't have proper nesting of the config. The servers field consists of an string/server-config map, where you can assign names to server config. It's more clear when you check the config structure at the servers level here. You need to do something like:

{
    "apps": {
        "http": {
            "http_port": 5000,
            "servers": {
                    "srv0": {
                        "automatic_https": {
                            "disable": true
                        },
...

Since this issue tracker is reserved for actionable development items, I'm going to close this, but we have a community forum where more people will be exposed to your question, including people who may be more expert or experienced with the specific question you're facing. I hope you'll ask your future question there, and thanks for understanding!