php - NGINX redirect from subdirectory to root with Slim API framework
one text
Solution:
The best approach I believe is to have the redirect happen at the ingress level or even prior to hitting the ingress. However, GCE ingress doesn't support HTTP to HTTPS redirects yet, let alone any kind of redirect.
The way you have it, is basically this way: the ingress gets a /v1
request then it goes to Nginx and then it says redirect to /
but that redirect request goes back to the ingress which says I don't know what to do with /
request.
Another approach is just to have your backend serve on /v1
or use a two-layered approach which is pretty common. GCE LB (with no ingress controller) ➡️ Nginx ingress (which does the redirect and has a much richer feature set) ➡️ backend.