在kong api网关中,如何制作自定义网址? [英] In kong api gateway, how to make custom url?

查看:70
本文介绍了在kong api网关中,如何制作自定义网址?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我正在使用微服务架构创建应用程序.我的微服务很少,我想使用自定义路由/url 在 kong 中配置所有微服务.

So I am creating application using microservice architecture. I have few microservices and I want to configure all in kong with custom routes/url.

例如:我有用户服务和位置服务,我希望 kong 中的路线如下所示:

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 ?

谢谢

推荐答案

我找到了一个解决方案,实际上该功能在 kong 中可用,但他们的文档解释得很差.

I found a solution, Actually this feature is available in kong but their documentation is very poorly explained.

所以基本上服务是主 url,那是你想要数据的实际路径,他们有从实际 url 获取数据的路由:

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:

最终用户--->路由(可以是多个)--->服务--->原始Url

End User--->routes (can be multiple) --->Service--->Original Url

例如:本地主机:8080/service1 --->/service1 --->www.google.com

ex: localhost:8080/service1 ---> /service1 ---> www.google.com

因此,当您转到 localhost:8080/service1 时,您可以看到 google 页面.

so when you go to localhost:8080/service1 you can see the google page.

这篇关于在kong api网关中,如何制作自定义网址?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆