I've php applications hosting in the Kubernetes cluster and using HAProxy to do TCP passthrough the request to the ingress-controller. My problem is the HAProxy unable to passthrough the header like REMOTE_ADDR.
I've tried follow the answer here to enable proxy protocol. But get error ERR_EMPTY_RESPONSE on browser and curl(52) with curl request after set the send-proxy or send-proxy-v2 and
To confirm it's not the ingress configuration problem, I've tried setup a php application outside the Kubernetes cluster listening port 8000 and use HAProxy to do TCP passthrough the request from port 80. This application also unable to get header REMOTE_ADDR.
HAProxy configuration for passthrough request to Kubernetes
frontend all443
bind *:443
timeout client 1800s
mode tcp
default_backend ingress443
backend ingress443
timeout connect 10s
timeout server 1800s
mode tcp
server k8s_ingress_svc 10.102.32.145:443
HAProxy configuration for passthrough request to local php application
frontend all80
bind *:80
timeout client 1800s
mode tcp
default_backend phpapp
backend phpapp
timeout connect 10s
timeout server 30s
mode tcp
server example_laravel 127.0.0.1:8000