Skip to content

Commit d9ce49b

Browse files
committed
grafana: serve files locally and allow caching for static files
1 parent e5d10e8 commit d9ce49b

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

packages/grafana/skel/etc/apache/conf.d/grafana.conf

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,17 @@
77

88
RewriteEngine On
99

10+
# server public folder directly, no need to pass through grafana and reverse proxy.
11+
RewriteCond %{REQUEST_URI} ^/${OMD_SITE}/grafana/public/(.*)$
12+
RewriteCond "${OMD_ROOT}/share/grafana/public/$1" "-f"
13+
RewriteRule "^/${OMD_SITE}/grafana/public/(.*)" "${OMD_ROOT}/share/grafana/public/$1" [L]
14+
15+
# enable caching for static files
16+
<LocationMatch /${OMD_SITE}/grafana/public/(build|img)/>
17+
ExpiresActive On
18+
ExpiresDefault "access plus 3 days"
19+
</LocationMatch>
20+
1021
<Location /${OMD_SITE}/grafana>
1122
ProxyPass http://127.0.0.1:###CONFIG_GRAFANA_TCP_PORT###/${OMD_SITE}/grafana retry=0 disablereuse=On
1223
ProxyPassReverse http://127.0.0.1:###CONFIG_GRAFANA_TCP_PORT###/${OMD_SITE}/grafana

0 commit comments

Comments
 (0)