Issue with running UI container behind Kong Gateway & Accessing routes with same paths

Hi,
I am new to Kong.

We were running 2 application in 4 docker containers with different ports for UI server port 4024 & 4025 & backend server is 9094 & 9091. I was able to create services & routes for the backend and thing worked fine.
Since we are running our application in cloud environment. Only port 8080 is enabled. So we need to make sure that even my UI containers are running behind the Gateway server, When we tried to do so we are facing 2 issues

  • When we try to access the ui-service2 kong always sends the request to only ui-service1, We know that it is because of same paths endpoint. Is there a way to overcome this issue?

We are running the container in same VM so we have the same URL with different ports.

Service Creation is like below

UI Server services
curl -i -X POST --url http://127.0.0.1:8001/services/ --data ‘name=ui-service2’ --data ‘url=https://y.y.y.y:4204’

curl -i -X POST --url http://127.0.0.1:8001/services/ --data ‘name=ui-service1’ --data ‘url=https://y.y.y.y:4205’

Routes creation

curl -i -X POST http://127.0.0.1:8001/services/ui-service1/routes --data ‘paths[]=/’ --data ‘name=uiserver1’

curl -i -X POST http://127.0.0.1:8001/services/ui-service2/routes --data ‘paths[]=/’ --data ‘name=uiserver1’

  • We are running the UI server bundled as a image, So whenever we try to access UI it loads the index.html without any issue but not loading the .js files. Is there anything we need to do to load dynamic files?

Would appreciate if anyone help

Thanks
Thilak

add
--data hosts[]=ui1.example.com
and
--data hosts[]=ui2.example.com

Thanks for your input. We tried and it is not working

How do you call web page?

The easiest way is set hostname in /etc/hosts

We are calling the webpages in the UI Container which is running in node express server.

And I am trying to access the hosts[] with ip address will that work?

No, Kong match route with hosts (domain name) and path.

If you use in container you can use extras host to set hosts name in container

Hey there,

That worked. Thanks