1. Caddy version (caddy version
):
2.4.6
2. How I run Caddy:
Via docker compose con Amazon ECS.
a. System environment:
Amazon ECS, Fargate. Docker compose file with docker client using ECS context.
b. Command:
Caddyfile
is base64 encoded in and environment variable. Then is decoded and copied to /etc/caddy/Caddyfile
. Then caddy run --config /etc/caddy/Caddyfile --adapter caddyfile
.
c. Service/unit/compose file:
services:
caddy:
image: caddy:2.4.6-alpine
ports:
- "80:80"
- "443:443"
- "2345:2345"
volumes:
- caddy_data:/data
- caddy_config:/config
command: ["sh", "-c", "echo ${CADDYFILE_B64} | base64 -d > /etc/caddy/Caddyfile && caddy run --config /etc/caddy/Caddyfile --adapter caddyfile"]
volumes:
caddy_data:
caddy_config:
d. My complete Caddyfile or JSON config:
{
debug
}
https://example.example.com {
reverse_proxy http://localhost:1234
}
https://example.example.com:2345 {
reverse_proxy http://localhost:2345
}
3. The problem I’m having:
When we do go to http://example.example.com/, we get redirected to https://example.example.com:2345/ instead of https://example.example.com:1234/.
% curl -IL http://example.example.com
HTTP/1.1 308 Permanent Redirect
Connection: close
Location: https://example.example.com:2345/
Server: Caddy
Date: Wed, 12 Jan 2022 14:57:00 GMT
HTTP/2 200
content-type: application/octet-stream
date: Wed, 12 Jan 2022 14:57:00 GMT
server: Caddy
content-length: 0
4. Error messages and/or full log output:
5. What I already tried:
Tried changing the order of the entries.