Tried to use
firewalldbut that makes the client IP opaque tocaddy
How did you set up firewalld to do this?
I am using the following rich rules to forward requests to caddy and caddy can see the client IP.
rule family="ipv4" forward-port port="80" protocol="tcp" to-port="8080"
rule family="ipv4" forward-port port="443" protocol="tcp" to-port="8443"
rule family="ipv4" forward-port port="443" protocol="udp" to-port="8443"
rule family="ipv6" forward-port port="80" protocol="tcp" to-port="8080"
rule family="ipv6" forward-port port="443" protocol="tcp" to-port="8443"
rule family="ipv6" forward-port port="443" protocol="udp" to-port="8443"
Make also sure that masquerade: no is set.