1. Caddy version (caddy version
):
2.4.6
2. How I run Caddy:
docker compose
a. System environment:
ubuntu 2004, docker
b. Command:
command: [ "caddy", "run", "--config", "/config/Caddyfile" ]
c. Service/unit/compose file:
Paste full file contents here.
Make sure backticks stay on their own lines,
and the post looks nice in the preview pane.
d. My complete Caddyfile or JSON config:
mydomain.io {
handle_path /microserviceA/* {
reverse_proxy localhost:8080
}
handle_path /microserviceB/* {
reverse_proxy localhost:8081
}
handle_path /microserviceC/* {
reverse_proxy localhost:8082
}
}
3. The problem I’m having:
Try to find a valid configuration example for Caddyfile for a simple common scenario.
4. Error messages and/or full log output:
ssl error/ timeout
5. What I already tried:
I have a very easy container group, like:
microserviceA → accessible via container port 8080
microserviceB → accessible via container port 8081
microserviceC → accessible via container port 8082
Now, I want to serve these microservices with automatic https and port mapping for the microservices/name using a Caddyfile.
For example, when someone calls the URL mydomain.io
caddy should resolves the right port to the docker container, which will be localhost:8080 in this example.
I’ve tried something like:
mydomain.io {
handle_path /microserviceA/* {
reverse_proxy localhost:8080
}
handle_path /microserviceB/* {
reverse_proxy localhost:8081
}
handle_path /microserviceC/* {
reverse_proxy localhost:8082
}
}
and I tried:
mydomain.io {
reverse_proxy /microserviceA/* localhost:8080
reverse_proxy /microserviceB/* localhost:8081
reverse_proxy /microserviceC/* localhost:8082
}
What’s wrong with that?
Can somebody please give an example of a valid Caddyfile for this easy scenario?