Merge v2.10 into v3.0

This commit is contained in:
mmatur 2023-10-11 16:20:26 +02:00
commit 286181aa61
No known key found for this signature in database
GPG key ID: 2FFE42FC256CFF8E
62 changed files with 712 additions and 189 deletions

View file

@ -5,6 +5,7 @@ import (
"fmt"
"mime"
"net/http"
"slices"
"strings"
"github.com/klauspost/compress/gzhttp"
@ -87,7 +88,7 @@ func (c *compress) ServeHTTP(rw http.ResponseWriter, req *http.Request) {
// Notably for text/event-stream requests the response should not be compressed.
// See https://github.com/traefik/traefik/issues/2576
if contains(c.excludes, mediaType) {
if slices.Contains(c.excludes, mediaType) {
c.next.ServeHTTP(rw, req)
return
}
@ -158,13 +159,3 @@ func encodingAccepts(acceptEncoding []string, typ string) bool {
return false
}
func contains(values []string, val string) bool {
for _, v := range values {
if v == val {
return true
}
}
return false
}