Search code examples
nginxkubernetesproxyhaproxy

How to create reverse proxy that forward traffic to kubernetes ingress controller such as haproxy ingress or nginx ingress


nginx configuration

i tried to forward traffic from server 192.168.243.71 to domain that show in command "oc get routes" / "kubectl get ingress", but its not as simple as that. The fact is my Nginx Reverse Proxy in server 192.168.243.x will forward the request to the IP Address of loadbalancer instead of the real domain that i wrote in nginx.conf

the result when i access 192.168.243.71

I was expecting it will show the same result when I access the domain via web browser that show in "oc get routes" or "kubectl get ingress"


Solution

  • Solved by adding set $backend mydomainname.com in server block and add dns resolver resolver 192.168.45.213; proxy_pass http://$backend; server in location block.

    Result