Can IP of backend server handling request be exposed to plugin?


I want my client app to know which backend server handled a particular request.
This is particularly useful to be able to aggregate things like number of errors and latency on a per backend server basis.

To that end I wanted to write a plugin that exposes the IP of the backend-server as a response header.
However, I think there sadly is no way that Traefik exposes this ip?

I got so far as getting a plugin (see below) to work hoping that ' req.RemoteAddr' would expose the data I was looking for, but no dice.

Is there a way for me to expose the IP?

func (a *Demo) ServeHTTP(rw http.ResponseWriter, req *http.Request) {
rw.Header().Set("X-Backend-IP", req.RemoteAddr), req)

Can’t you set the response header by your service/container/app directly?