So I am creating application using microservice architecture. I have few microservices and I want to configure all in kong with custom routes/url.
For example: I have user service and location service and I want those routes in kong looks like this:
GET http://localhost:8001/service/user/list --> http://user-service-url.com/user_list
GET http://localhost:8001/service/location/122332--> http://location-service-url.com/get/122332
I have searched all over the internet and couldn't find anything. Is this possible to achieve in kong ?
Thanks
-
What does .local signify here ?Shaleen– Shaleen2020年05月09日 06:54:55 +00:00Commented May 9, 2020 at 6:54
-
@Shaleen its suppose to be domain, that contain my service. check here: discuss.konghq.com/t/… i asked the same question with little more detailsSupun Praneeth– Supun Praneeth2020年05月09日 09:07:41 +00:00Commented May 9, 2020 at 9:07
2 Answers 2
Sure, that is what Kong is supposed to do: reverse-proxying.
Just create a Kong service object containing the complete URL (http://user-service-url.com/user_list) to your upstream service and attach a Kong route object to it with the path you want to publish on your gateway host (/service/user/list).
Comments
I found a solution, Actually this feature is available in kong but their documentation is very poorly explained.
So basically service is the main url, that's the actual path you want data from, and they have route which get data from actual url:
End User--->routes (can be multiple) --->Service--->Original Url
ex: localhost:8080/service1 ---> /service1 ---> www.google.com
so when you go to localhost:8080/service1 you can see the google page.