in Caddy 2.5, logging remote_addr was depreciated in favor of remote_ip. I maintain the RealIP plugin which changes the remote_addr of a request to be the value of a specific header, usually X-Forwarded-For:
Historically the operation of the plugin has always been a bit weird, since if you look directly at the system logs you see the unaltered IP as remote_addr, but if you enable access logging with common_log format you’d see the replaced value
That is because the original request was logged before passing to the handlers. However the common_log variables got updated after the handlers as shown at these 2 lines prior to v2.5:
With Caddy 2.5, the request variables that would allow the plugin to function are not updated after the request passes thru the handlers as shown here:
What options would be available to repair the original functionality?
I don’t think we can reasonably make it possible for a request handler to modify the logs being output. Your plugin has a flawed design, it’s trying to mutate something that’s inherently immutable. The point of the request log is to show the request as Caddy received it.
Or alternatively, post-process the logs with some tool/script to read the X-Forwarded-For header values in the log and shove it in the remote_ip field.