Lua sending localhost as source IP

I have been trying to use crowdsec with my HAProxy configuration but am running into a problem where the source IP that is sent for source IP is always localhost. The reason for this is because I have a loop in my HAProxy configuration.

All of the backend servers report the client IP since I am using forwardfor but when requesting source IP with a lua script it is reporting localhost.

My HAProxy configuration and explanation for the configuration can be seen here.

Figured it out.