Map origin hostnames with application paths in ingress nginx controller

I have an API gateway installed in an EKS cluster and I have this communication flow:

User -> F5 LB -> Nginx Ingress Controller LB (devapi.example.com) -> Service -> API Gateway Pods

Right now I am accessing APIs directly through ingress controller load balancer by using the DNS name devapi.example.com and an application path. My ingress template matches the hostname (which is unique and shared for all APIs) and forwards the appended path in the URL to the application pod like this so it can reach the correct API:

https://devapi.example.com/hello-world -> https://api-gateway-service/hello-world

What I need

I want to start publishing applications with a different DNS name for each one in F5. I can publish DNS names in F5 and point them to devapi.example.com (don’t really know if I can append a path here). I would like to publish application DNSs in F5 so I can have a DNS name for each application which would redirect to devapi.example.com appending an specific path based on origin DNS:

hello-world-dev.example.com -> devapi.example.com/hello-world
liveness-check-dev.example.com -> devapi.example.com/health

Some hostnames might not match any word in the path (see the liveness-check-dev hostname). Is there any way to map the origin hostnames from F5 with application paths so I can rewrite my paths?

Leave a Comment