traefik/middlewares/compress.go
2016-09-28 23:04:18 +01:00

16 lines
381 B
Go

package middlewares
import (
"github.com/NYTimes/gziphandler"
"net/http"
)
// Compress is a middleware that allows redirections
type Compress struct {
}
// ServerHTTP is a function used by negroni
func (c *Compress) ServeHTTP(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc) {
newGzipHandler := gziphandler.GzipHandler(next)
newGzipHandler.ServeHTTP(rw, r)
}