Don't allow direct calls to Microservices. Only allow through API Gateway

前端 未结 5 1603
走了就别回头了
走了就别回头了 2020-12-25 13:06

Maybe this is a strange question (I\'m new with Microservices). But I\'m looking for some info on how proceed with this. Does not need to be Spring specific, but that\'s the

5条回答
  •  一生所求
    2020-12-25 13:59

    Assuming that you have a firewall in place, you could restrict inbound traffic to server to the ports that your Zuul endpoints are exposed on and disallow anyone from accessing the microservices' ports directly.

    If you want to avoid going the firewall route, you could force the endpoints to check for a specific HTTP header or something that is set by Zuul prior to forwarding a request, but that would be hacky and easy to circumvent. Based on my past experiences, the "right" way would be to do this via a firewall. Your app should be responsible for dealing with requests. Your firewall should be responsible for deciding who can hit specific endpoints.

提交回复
热议问题