grafana / tutorials

A series of tutorials for helping you make the most out of Grafana.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[PR] Run grafana behind nginx: fail to load grafana if cache policy exists

BennyThink opened this issue · comments

commented

Hi!
I just find an interesting problem.

If I have js/css cache policy in Nginx, the directives on your website will result in 404
For example, If my nginx settings are

location ~ .*\.(js|css|woff)?$ {
        expires 30d;
    }

location /grafana/ {
   proxy_pass http://localhost:3000/;
  }

Grafana will always failed to load because the priority of location ~ is higher than location /grafana/
It will fail as long we have location ~ .

A simple solution is change location /grafana/ to location ~/grafana/ and make it as the first location block.

I've created a PR for this.

Reference: Nginx location priority

commented

Merged and closed