Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to inject directives in an existing service? #639

Open
wsw70 opened this issue Jul 4, 2024 · 4 comments
Open

Is it possible to inject directives in an existing service? #639

wsw70 opened this issue Jul 4, 2024 · 4 comments

Comments

@wsw70
Copy link

wsw70 commented Jul 4, 2024

sorry -- this is a question and not an Issue but the ""Discussions" tab is not enabled"

I want to change an existing service's definitions in caddy, from another service's docker-compose. Specifically, if you take the example of wildcards in the caddy documentation

*.example.com {
	tls {
		dns <provider_name> [<params...>]
	}

	# Fallback for otherwise unhandled domains
	handle {
		abort
	}
}

This would go directly into caddy's docker-compose labels and then each new site, from its own docker-compose YAML, would need to "inject" into the configuration above blocks such as

	@foo host foo.example.com
	handle @foo {
		respond "Foo!"
	}

Is this possible?

@francislavoie
Copy link
Collaborator

Yes, labels with the same site address get merged.

@wsw70
Copy link
Author

wsw70 commented Jul 4, 2024

Yes, labels with the same site address get merged.

OK thank. I understand that you mean that when adding extra *.example.com entries in specific docker-compose files, it will be merged. If so I will try to go for configurations such as

caddy: *.example.com
caddy.@foo: host foo.example.com
caddy.handle.@foo: respond "Foo!"

and see how it goes

@francislavoie
Copy link
Collaborator

Path matching is exact. /api only matches that, and not /api/foo. Use /api/* instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@wsw70 @francislavoie and others