I have Spring Boot application. It has endpoint
/api/check
So I can call it locally via
localhost:8080/api/check
I'd like to deploy it to Kubernetes. And there will be more services. So I need to define routing to this applications. For instance
my.app/service1/api/check
my.app/service2/api/check
my.app/service2/api/ping
By default such routing will not work. An example is Unable to access Spring Boot microservice exposed via nginx ingress controller on Kubernetes cluster running on AWS
But question is: Should I use rewriting or I should modify my app to handle mapping with prefix like this
localhost:8080/service1/api/check
What are pros and cons for both solutions?