Custom URL redirects


I have received the request to provide custom (pretty) urls to specific dashboards. I have set up nginx, defined the grafana server as an upstream, and configured this for testing:

    location = /projecten/ {
        proxy_pass http://grafana_servers/d/z6edYNbmz/;
    location / {
        proxy_pass http://grafana_servers;

According to Nginx manual, it should try to pick the longest matching prefix, so order shouldn’t matter.

The regular / location works perfectly fine; however, for some reason I get a 404 message from grafana when I try to go to the /projecten/ url. The URL it redirects to works when entered as is (well, upstream replacement, but hardcoded yields the same problem). Redirecting that path to another website entirely works as expected.

I can’t seem to figure out why it doesn’t work - I’ve considered webroot path not being configured in Grafana, but the proxy_pass directive should remove the pretty path, as I understand it.

Has anyone managed to get such a setup to work?