I have this long URL with
I'd like to http://shortk8s.com
to go directly to the full URL while appending the query strings Ex. http://shortk8s.com?namespace=default
.
So basically this part of the URL I'd like to be excluded from but somehow rewritten in NGINX.
api/v1/namespaces/kube-system/services/http:kubernetes-dashboard:/proxy/#!/workload
My initial attempt is as follows:
server {
listen 80;
server_name shortk8s.com;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_cache off;
location / {
rewrite .* api/v1/namespaces/kube-system/services/http:kubernetes-dashboard:/proxy/#!/workload/$1 break;
proxy_pass http://127.0.0.1:8001;
}
}
It failed, anything suggestions?