Hi there.
We have a setup where a custom built router forwards requests to our kong server. We have configured Kong to serve routes via the hosts directive ( as per https://docs.konghq.com/1.2.x/admin-api/#add-route ).
Imagine we have two sites, site1.example.org and site2.example .org
Kong has several services and routes configured, one though has a hosts entry of site1.example .org, another has site2.example .org
The kong server has a hostname of kong.example .org
A user types into their browser site1.example.org and hits our load balancer ( this bit works )
Our custom router forwards that request to kong.example .org ( this bit works )
Kong does not route that request as per the hostname entered in the users browser ( site1.example .org )
If I log onto the Kong server and curl localhost and pass the header Host: site1.example .org ( this works ).
Our custom router populates the Host Header with Host: kong.example.org but populates the forwarded header with the correct name ( site1.example.org ), it also populates x-fowarded-host header with site1.example .org.
My question is, how do I tell Kong to route the request based on either the x-forwarded-host or forwarded header?
I’ve seen loads of documentation around passing the clients IP address upstream by setting trusted_ip in kong.conf. I’ve also tried adding preserve_host to the route but no joy.
Please could someone offer their guidance for me to get around this issue.
Many thanks
N.B. cause I’m a new user I can only post 5 links
Chris