Interview Prep/Kubernetes/Services, Ingress and DNS

How do you do path-based rewrite for an app that expects to be served from `/`?

IntermediateScenarioServices, Ingress and DNS
Answer

Situation read → You expose /shop but the app serves assets from /.

What I'd do →

  1. With ingress-nginx use nginx.ingress.kubernetes.io/rewrite-target: /$2 and path /shop(/|$)(.*) with pathType: ImplementationSpecific
  2. Better, configure the app base path
  3. Check redirects and absolute asset URLs
  4. Test with curl -I
  5. Consider a subdomain instead of paths

Why → Rewriting handles incoming paths but not links generated by the app, so base-path support in the app is cleaner.

Interview tip → Say you prefer subdomains to avoid path rewriting complexity.

All Kubernetes questions Roadmap: Kubernetes networking, storage & scaling

More on Services, Ingress and DNS