Is there currently an option to allow Kratos to re...
# talk-kratos
b
Is there currently an option to allow Kratos to respond to a path prefix? E.g. mount the routes at
/api/auth/<Kratos URL>
and have Kratos strip the prefix? I found this issue that says it wasn’t possible a year ago, but maybe that’s changed? For context, I’m attempting to run Kratos on AWS EKS and Amazon’s ALBs don’t have the capability to rewrite URLs. I’d prefer to avoid running another reverse proxy if at all possible.
w
I would recommend against this design solely on the fact that every kratos API client will need some custom work before before it will work with this path scheme. So if that's out, and reverse proxies are a pain -- maybe a subdomain would suffice?
<http://kratos.example.com|kratos.example.com>
?
b
@wide-butcher-30761 I’m not sure I follow about the Kratos API clients, what rework would be needed? My understanding is that there are no issues with using Kratos mounted with a prefix (and my current implementation is set up this way), it’s purely a matter of where the prefix stripping takes place. I was hoping that
kratos serve
had the ability to strip prefixes, but it doesn’t seem like that’s the case. Since asking the question, I’ve reworked our ingress to use an Amazon Network Load Balancer sitting infront of ingress-nginx, with ingress-nginx doing the path rewriting. I don’t love having the extra steps, but it’s at least functional for now.
w
If users outside your load balancer have to prepend something to their request path to get to known Kratos endpoints, then that client library will also have to support prepending paths. Probably only an issue if you want to use generated clients right out of the box? Request rewriting solves the issue of what path Kratos receives, so that's fine. It's just the added fuss of setting up whatever is doing rewrites (Load balancer or reverse proxy, etc). Kratos won't know any different so it's safe to do. I was just trying to offer another solution that didn't add the complexity of path rewriting. Glad you made it work!