This line is needed for that to work.
Without it all the requests are still the loadbalancer IP.
I know because my discourse was down for 429 errors.
In case it’s not clear this is my infra:
user > haproxy > discourse
Discourse of course includes an nginx rproxy
I included the forwarding headers in haproxy but the discourse internal nginx was not respecting forwarded for. I had to add the 2 lines in my OP and restart the container for it to work.