Skip to content

Merging directives from different sources under the same domain blockΒ #733

@MoShrank

Description

@MoShrank

Hey!

Problem:
Merging two directives from different config sources under the same site block does not work.

Example:

Caddyfile

example.domain.com {
	handle_path /chat/* {
		uri strip_prefix /chat
		reverse_proxy chat:3002
	}
}

docker-compose.yaml

...
 labels:
            caddy: example.domain.com
            caddy.handle: "/*"
            caddy.handle.reverse_proxy: "{{upstreams 3000}}"
...

I would expect those directives to be merged under the same site domain like this:

example.domain.com {
        handle {
               reverse_proxy: {{ upstreams 3000 }}
        }

	handle_path /chat/* {
		uri strip_prefix /chat
		reverse_proxy chat:3002
	}
}

However that doesn't work and instead I get this error:

{"level":"info","ts":1752836013.019566,"logger":"docker-proxy","msg":"Process Caddyfile","logs":"[ERROR] Removing invalid block: Caddyfile:2: unrecognized global option: handle_path\n{\n\thandle_path /chat/* {\n\t\treverse_proxy 172.18.0.3:3002\n\t\tstrip_prefix /chat\n\t}\n}\n\n"}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions