Closed maxiride closed 8 months ago
I've tried to update the application labels removing the upstreams token and setting directly the container name:
caddy: example.com
caddy.reverse_proxy: container_name:3000
and the compiled caddyfile from caddy-docker-proxy still has the double entry.
reverse_proxy container_name:3000 :3000
So it's like if the caddyfile is being assembled with data from other sources. I did configured the ENV variable CADDY_DOCKER_CADDYFILE_PATH
but there are completly different hostnames and directive so it's impossible that a merge from the base Caddyfile ends up there.
External caddyfile being passed:
exampleA.it {
root * /mnt/16-share/video/progetto_video
file_server
}
exampleB.it, exampleC.it {
reverse_proxy 172.21.15.36:9001
}
web.exampleO.it, mail.exampleD.it {
reverse_proxy 192.168.0.16
}
So it's like if the caddyfile is being assembled with data from other sources. I did configured the ENV variable
Found the culprit. The application recently had an upgrade, there as a second container with the same labels that ended up being merged. The odd things is that the second container was stopped several weeks ago, caddy-docker-proxy shouldn't read labels of stopped containers.
Now that I eventually understood the underlying issue I found the PR https://github.com/lucaslorentz/caddy-docker-proxy/pull/560, but it has not been released yet.
Being a pretty breaking change I would have hoped it urged a new release sooner. 😢
@maxiride You're right, that is indeed a quite relevant fix. Releases are automated and straight forward, I just missed that this fix was in the queue.
Doing a release right now: https://github.com/lucaslorentz/caddy-docker-proxy/releases/tag/v2.8.11
Given the labels of a container that runs a process listening on port 3000 (port inside the container). The application container and the caddy container are in the same custom bridge network.the compiled caddyfile is:
which results in a 50/50 change of being proxied to the actual container (10.20.14.2:3000) or getting a connection refused when connecting to
:3000
which is the caddy container itself. The internal IP of the application container10.20.14.2
is resolved correctly.I would expect the caddyfile to be:
Am I configuring wrongly the labels?
Docker version: lucaslorentz/caddy-docker-proxy:2.8.10
I've tried to spin up a whoami container and the compiled caddyfile doesn't show this issue. So I suppose something is wrong with my app container configuration rather than caddy-docker-proxy. Here is the stripped down docker configuration:
And the compiled caddyfile is below, everything is as expected except for the double entries in the reverse_proxy directives: