I want to log and set a header containing which upstream gets connected to in my reverseproxy server, but get empty result from {upstream} placeholder.
Caddy v0.10.11 on Ubuntu 16.04
Caddyfile
reverseproxy.example {
proxy / {
upstream 10.10.10.1:80
upstream 10.10.10.2:80
policy first
health_check /
transparent
header_downstream +x-proxy-upstream {upstream}
}
gzip
cache {
default_max_age 24h
}
log / stdout “{combined} cache={cache_status} proxy-upstream={upstream}”
}
journalctl
Feb 24 13:32:41 gateway caddy[9459]: 120.188.33.229 - - [24/Feb/2018:13:32:41 +0000] “GET / HTTP/2.0” 200 4990 “-” “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.167 Safari/537.36” cache=miss proxy-upstream=-
The x-proxy-upstream header is not included in the response header as well.