So I am running into an issue with grafana and caddy with grafana as a sub-directory. I saw this post from awhile ago and I tried what as listed as a working config here but it is not working.
I can see the http GET request in my grafana container logs but caddy is saying there is no such site on port 80.
Caddy log:
2019/02/01 01:44:49 [INFO] xx.xx.xx.xx - No such site at :80 (Remote: xx.xx.xx.xx, Referer: )
Grafana log:
t=2019-02-01T01:53:14+0000 lvl=info msg=“HTTP Server Listen” logger=http.server address=0.0.0.0:3000 protocol=http subUrl=/grafana socket=
t=2019-02-01T01:55:44+0000 lvl=info msg=“Request Completed” logger=context userId=0 orgId=0 uname= method=GET path=/grafana status=404 remote_addr=xx.xx.xx.xx time_ms=7 size=26532 referer=
t=2019-02-01T01:55:45+0000 lvl=info msg=“Request Completed” logger=context userId=0 orgId=0 uname= method=GET path=/grafana/public/build/vendor.469095018b321ef1da7c.js status=404 remote_addr=xx.xx.xx.xx time_ms=5 size=26532 referer=https://domain.net/grafana
t=2019-02-01T01:55:45+0000 lvl=info msg=“Request Completed” logger=context userId=0 orgId=0 uname= method=GET path=/grafana/public/build/grafana.dark.469095018b321ef1da7c.css status=404 remote_addr=xx.xx.xx.xx time_ms=3 size=26532 referer=https://domain.net/grafana
t=2019-02-01T01:55:45+0000 lvl=info msg=“Request Completed” logger=context userId=0 orgId=0 uname= method=GET path=/grafana/public/build/app.469095018b321ef1da7c.js status=404 remote_addr=xx.xx.xx.xx time_ms=3 size=26532 referer=https://domain.net/grafana
t=2019-02-01T02:02:52+0000 lvl=info msg=“Request Completed” logger=context userId=0 orgId=0 uname= method=GET path=/grafana status=404 remote_addr=xx.xx.xx.xx time_ms=3 size=26532 referer=
t=2019-02-01T02:02:52+0000 lvl=info msg=“Request Completed” logger=context userId=0 orgId=0 uname= method=GET path=/grafana/public/build/grafana.dark.469095018b321ef1da7c.css status=404 remote_addr=xx.xx.xx.xx time_ms=4 size=26532 referer=https://domain.net/grafana
Caddyfile (note: I also tried without the http:// and got the same result):
www.domain.net, domain.net {
gzip
header / {
Content-Security-Policy
default-src "*"
X-Frame-Options "DENY"
X-Content-Type-Options "nosniff"
X-XSS-Protection "1; mode=block"
Strict-Transport-Security "max-age=31536000;"
Referrer-Policy "same-origin"
Feature-Policy "self"
}
tls certs@domain.net
proxy /grafana http://10.9.9.132:3000 {
transparent
websocket
}
and my grafana container docker run command:
docker run -d --user 1000 --volume "/home/alexander/grafana:/var/lib/grafana" -p 3000:3000 -e "GF_SERVER_ROOT_URL=%(protocol)s://domain.net/grafana" -e "GF_SERVER_DOMAIN=domain.net" -e "GF_SECURITY_ADMIN_PASSWORD=admin" -e "GF_INSTALL_PLUGINS=natel-influx-admin-panel,ryantxu-annolist-panel,jdbranham-diagram-panel,grafana-worldmap-panel,grafana-piechart-panel" grafana/grafana
GF_SERVER_ROOT_URL and GF_SERVER_DOMAIN are defined here as required env variables when setting up grafana as a sub directory. However when I navigate to the directory I get:
If you’re seeing this Grafana has failed to load its application files
- This could be caused by your reverse proxy settings.
- If you host grafana under subpath make sure your grafana.ini root_path setting includes subpath
- If you have a local dev build make sure you build frontend using: npm run dev, npm run watch, or npm run build
- Sometimes restarting grafana-server can help