Some background on what I'm asking for help with setting up is:
I have a customer's web server running nginx, which is functioning & behind a HAProxy server. The HAProxy server is setup using TCP, instead of HTTP, so nginx is handling its own SSL certificates, which it is currently doing. My current setup passes the internal HAProxy IP to nginx even when proxy_set_header X-Real-IP $remote_addr & proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for & proxy_set_header X-Forwarded-Proto $scheme are all set in the nginx config. I then learned on the HAProxy forum that nginx's "X-Forwarded-For is a HTTP header, it can't be inserted into a TCP stream." [source - https://discourse.haproxy.org/t/x-forwarded-for-in-tcp-mode/2969], so this method will not work with my setup.
This customer's requires the client's IP to be correctly passed thru to nginx, and not the internal IP which is currently being passed to nginx. After more digging, I discovered that HAProxy does have a means of passing the IP correctly to nginx called the PROXY protocol and that nginx can be configured to work with it. [source - https://www.haproxy.com/blog/use-the-proxy-protocol-to-preserve-a-clients-ip-address/] On this HAProxy page, it contained a link to the nginx documentation to set this up.
I am having trouble finding example nginx configurations to learn how to correctly configure this. There's a brief example in the nginx documentation about it here, https://docs.nginx.com/nginx/admin-guide/load-balancer/using-proxy-protocol/#proxy-protocol-for-a-tcp-connection-to-an-upstream, but that was not very helpful for me & I'm having trouble locating other nginx examples of this type of setup.
Does anyone here have any suggestions or has anyone here have experience setting up this type of configuration before? Thanks for your help as I'm having trouble finding what I'm looking for out on the sea we call the internet.