motiv-labs / janus

An API Gateway written in Go
https://hellofresh.gitbooks.io/janus
MIT License
2.79k stars 317 forks source link

how to distinguish the internal service and external service #308

Closed hurner closed 6 years ago

hurner commented 6 years ago

in my opinion, both external and internal services need to registered in the janus proxy, but how to restrict the interface service not be invoked by external consumers? use the hostname or other methods?

thanks

italolelis commented 6 years ago

Hi @hurner,

Let me share my opinion on this topic with you.

An API Gateway generally is used in the edge layer of your architecture, this means that it will sit on top of all your services downstream. An API Gateway is carefully designed to protect your services from the external world. One can also say it brings a lot of great features (especially canary releases deployment) that make communication between services easier, but that's normally not the API Gateway responsibility. A Service Mash would be what you would use for service-to-service communication.

A Service Mash can work in conjunction with an API Gateway and this is a great combination in a microservice world. You would use the gateway to protect and expose services to the external world and you would use service mesh for all your internal communication.

You can check out this article for more insights: https://medium.com/microservices-in-practice/service-mesh-vs-api-gateway-a6d814b9bf56

I hope this could explain my view a little bit. Now let me answer your question:

If you want to make the Gateway take care of internal and external requests you can do that with HOST filters, but that's the only way that you can do that with Janus at the moment.

rafaeljesus commented 6 years ago

+1 for what @italolelis said, if you need to manage service to service go for service mesh, api gateway/manager is not for that despite possible

hurner commented 6 years ago

@italolelis , Thanks for your understanding, i think i have got what you mean, thanks agin.