1. The problem I’m having:
I created a docker-compose file with angular, .net core API, and caddy as a reverse proxy.
I can get the HTML from the angular app.
The problem is when I try to hit any endpoint from the API, it returns a 200 OK response but with an “empty” response body.
So. The API exposes ports 5001:5001. If I hit https://localhost:5001/api/securoty/login with the credentials it returns a json response, however, if I hit https://api.localhost/api/securoty/login the API response has a 200 OK with an empty response body.
curl -vL ‘https://api.localhost/security/login’ --header ‘Content-Type: application/json’ --data-raw ‘{“email”: “user@gmail.com”,“password”: “Password#”}’
Result:
- Host api.localhost:443 was resolved.
- IPv6: ::1
- IPv4: 127.0.0.1
- Trying [::1]:443…
- Connected to api.localhost (::1) port 443
- schannel: disabled automatic use of client certificate
- ALPN: curl offers http/1.1
- schannel: next InitializeSecurityContext failed: Unknown error (0x80096004) - The signature of the certificate cannot be verified.
- Closing connection
- schannel: shutting down SSL/TLS connection with api.localhost port 443
curl: (35) schannel: next InitializeSecurityContext failed: Unknown error (0x80096004) - The signature of the certificate cannot be verified.
2. Error messages and/or full log output:
Http code 200 : blank page
3. Caddy version:
2.8.4-alpine
4. How I installed and ran Caddy:
a. System environment:
Windows 11 Pro - Docker compose
b. Command:
docker compose up -d
d. My complete Caddy config:
{
debug
}
admin.localhost {
tls internal
reverse_proxy floreria-admin:4200
}
api.localhost {
reverse_proxy /api/* floreria-api:5001
log {
format console
output stdout
}
}
5. Links to relevant resources:
Here is my docker compose file
services:
caddy:
image: caddy:2.8.4-alpine
container_name: caddy
ports:
- "80:80"
- "443:443"
- "443:443/udp"
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile
- caddy_data:/data
- caddy_config:/config
depends_on:
- floreria-api
- floreria-admin
floreria-admin:
build:
dockerfile: ./floreria-admin/Dockerfile
context: .
container_name: floreria.admin
ports:
- "4200"
depends_on:
- floreria-api
floreria-api:
build:
dockerfile: ./Backend/Floreria.Api/Dockerfile
context: .
environment:
- ASPNETCORE_ENVIRONMENT=Development
- ASPNETCORE_Kestrel__Certificates__Default__Password=Patito10
- ASPNETCORE_Kestrel__Certificates__Default__Path=/https/aspnetapp.pfx
container_name: floreria.api
ports:
- "5001:5001"
volumes:
- ./temp-keys/:/root/.aspnet/DataProtection-Keys
- ./certificate/.aspnet/https:/https:ro
depends_on:
- floreria-db
floreria-db:
image: mcr.microsoft.com/mssql/server:2022-latest
container_name: floreria.db
environment:
- ACCEPT_EULA=Y
- SA_PASSWORD=Patito10#
ports:
- "5002:1433"
volumes:
caddy_data:
caddy_config: