0

I have a group of upstream servers,I have been trying to print the upstream URL in the access logs where the request went to. I tried proxy_host and upstream_addr. But they didn't solve my issue. "proxy_host" prints the upstream name, not the URL, and upstream_addr prints the IP address. Is there a way to print the URL in the access logs?

upstream backend {
   server backend1.example.com:8080  weight=90;
   server backend2.example.com:8080  weight=10
}

location /test
set $foo backend;
proxy_pass https://$foo

with proxy_host, the access log prints "proxy_host=backend". If I use "upstream_addr", it prints the IP "upstream_addr=10.1.0.0".

Is there a way to print, If the request is routed to backend1.example.com or backend2.example.com?

batman
  • 1

0 Answers0