Data source proxy: Fixed issue with Gzip enabled and data source proxy, Fixes #1675
This commit is contained in:
+2
-1
@@ -42,8 +42,9 @@ func newMacaron() *macaron.Macaron {
|
||||
m := macaron.New()
|
||||
m.Use(middleware.Logger())
|
||||
m.Use(macaron.Recovery())
|
||||
|
||||
if setting.EnableGzip {
|
||||
m.Use(macaron.Gziper())
|
||||
m.Use(middleware.Gziper())
|
||||
}
|
||||
|
||||
mapStatic(m, "", "public")
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package middleware
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/Unknwon/macaron"
|
||||
)
|
||||
|
||||
func Gziper() macaron.Handler {
|
||||
macaronGziper := macaron.Gziper()
|
||||
|
||||
return func(ctx *macaron.Context) {
|
||||
requestPath := ctx.Req.URL.RequestURI()
|
||||
if strings.HasPrefix(requestPath, "/api/datasources/proxy") {
|
||||
return
|
||||
}
|
||||
|
||||
ctx.Invoke(macaronGziper)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user