Home > Net >  Is redirection a best practice in microservice
Is redirection a best practice in microservice

Time:06-14

I am developing a microservice that accepts x-www-form-urlencoded content type and has some redirects to external URLs, is this a bad practice to have a redirection?

CodePudding user response:

The motive behind Microservices is to decentralize and decouple the program so that they can operate independently !

Redirection may be a bad thing here as it would be simple to just call that Microservice end points rather than redirecting from another microservice (Unless you want to main abstractions and avoid direct calling , which you can still do via Async communication for e.g. via MQs such as RabbitMQ or Apache Kafka )

Re-direction would ultimately increase the HTTP calls eventually increasing unwanted traffic which you won't want !

I'd suggest to go through some theory which might be helpful for you to design & decide well

https://microservices.io/

CodePudding user response:

It dependens. Redirection is not a bad practice by itself. A microservice can perfectly communicates with either other microservices or external services if needed. It depends of your achitecture.

  • Related