mirror of
https://github.com/grafana/grafana.git
synced 2024-11-30 12:44:10 -06:00
27 lines
466 B
Go
27 lines
466 B
Go
package middleware
|
|
|
|
import (
|
|
"strings"
|
|
|
|
"github.com/go-macaron/gzip"
|
|
"gopkg.in/macaron.v1"
|
|
)
|
|
|
|
func Gziper() macaron.Handler {
|
|
macaronGziper := gzip.Gziper()
|
|
|
|
return func(ctx *macaron.Context) {
|
|
requestPath := ctx.Req.URL.RequestURI()
|
|
// ignore datasource proxy requests
|
|
if strings.HasPrefix(requestPath, "/api/datasources/proxy") {
|
|
return
|
|
}
|
|
|
|
if strings.HasPrefix(requestPath, "/api/plugin-proxy/") {
|
|
return
|
|
}
|
|
|
|
ctx.Invoke(macaronGziper)
|
|
}
|
|
}
|