Library change for compress middleware to increase performance
This commit is contained in:
parent
16f65f669b
commit
c515ace328
4 changed files with 110 additions and 20 deletions
|
@ -6,8 +6,8 @@ import (
|
|||
"mime"
|
||||
"net/http"
|
||||
|
||||
"github.com/klauspost/compress/gzhttp"
|
||||
"github.com/opentracing/opentracing-go/ext"
|
||||
"github.com/traefik/gziphandler"
|
||||
"github.com/traefik/traefik/v2/pkg/config/dynamic"
|
||||
"github.com/traefik/traefik/v2/pkg/log"
|
||||
"github.com/traefik/traefik/v2/pkg/middlewares"
|
||||
|
@ -61,10 +61,10 @@ func (c *compress) GetTracingInformation() (string, ext.SpanKindEnum) {
|
|||
}
|
||||
|
||||
func (c *compress) gzipHandler(ctx context.Context) http.Handler {
|
||||
wrapper, err := gziphandler.GzipHandlerWithOpts(
|
||||
gziphandler.ContentTypeExceptions(c.excludes),
|
||||
gziphandler.CompressionLevel(gzip.DefaultCompression),
|
||||
gziphandler.MinSize(gziphandler.DefaultMinSize))
|
||||
wrapper, err := gzhttp.NewWrapper(
|
||||
gzhttp.ExceptContentTypes(c.excludes),
|
||||
gzhttp.CompressionLevel(gzip.DefaultCompression),
|
||||
gzhttp.MinSize(gzhttp.DefaultMinSize))
|
||||
if err != nil {
|
||||
log.FromContext(ctx).Error(err)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue