I don't think that is it a bug. But I can't find a good example for this use case.
caddy -version)?0.8.2
Proxy subdomain to different servers
:443
proxy subdomain.example.de/ someserver:8080 {
proxy_header Host {host}
proxy_header X-Real-IP {remote}
proxy_header X-Forwarded-Proto {scheme}
}
proxy subdomainA.example.de/ someserver:8000 {
proxy_header Host {host}
proxy_header X-Real-IP {remote}
proxy_header X-Forwarded-Proto {scheme}
}
tls {
max_certs 10
}
log /var/log/caddy.log
gzip
As a Docker container linked with docker-compose to other containers.
The specified servers (someserver)
404 Not Found
You want something like this instead:
subdomain.example.de {
proxy / someserver:8080 {
proxy_header Host {host}
proxy_header X-Real-IP {remote}
proxy_header X-Forwarded-Proto {scheme}
}
log /var/log/caddy.log
gzip
}
subdomainA.example.de {
proxy / someserver:8000 {
proxy_header Host {host}
proxy_header X-Real-IP {remote}
proxy_header X-Forwarded-Proto {scheme}
}
log /var/log/caddy.log
gzip
}
In other words, you're serving two different sites. Most directives only take a base path as the first argument, not comparing on the whole URI.
Okay, I got it. Thanks!
Most helpful comment
You want something like this instead:
In other words, you're serving two different sites. Most directives only take a base path as the first argument, not comparing on the whole URI.