Using haproxy how do I get Discourse to recognize remote IP?

I’m using haproxy as a way of having apache, webmin, and pwm running on the same machine under different subdomains. The setup works beautifully, but Discourse shows the localhost for the IP address for all user activity, clearly this is going to make fighting spam harder (IP blocking would not work, etc).

Is there a way to get discourse to recognize the proper remote IP addresses?

I solved this myself.

I had to add this to my haproxy.cfg under “defaults”:

option forwardfor

I feel kinda dumb, I had it in the wrong spot.