Routing
server {
listen 80;
server_name localhost;
resolver kube-dns.kube-system.svc.cluster.local valid=10s;
location /app { # /app means to route public URL to /app
# e.g. rewrite /<application-service-name>/app to just the 2nd part which is /app
# User will access the 2nd argument (/app), and /app
# will reroute to /<application-service-name>/app
rewrite /(.*)/(.*) /$2 break; # $2 refers to the 2nd (.*)
# $1 is <application-service-name> first (.*) in rewrite
proxy_pass http://$1.<NAMESPACE>.svc.cluster.local:80;
proxy_redirect off;
proxy_set_header Host $host;
}
}Last updated