MM-25369: Disable Brotli in 'dev' mode. (#14608)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
173cfe9b88
Коммит
e8daab6b84
@@ -126,11 +126,13 @@ func staticFilesHandler(handler http.Handler) http.Handler {
|
|||||||
|
|
||||||
func brotliFilesHandler(handler http.Handler) http.Handler {
|
func brotliFilesHandler(handler http.Handler) http.Handler {
|
||||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
isRequestingBrotliFile, contentType := requestingBrotliFileExtension(r)
|
if model.BuildNumber != "dev" {
|
||||||
if isRequestingBrotliFile && acceptsEncodingBrotli(r) {
|
isRequestingBrotliFile, contentType := requestingBrotliFileExtension(r)
|
||||||
r.URL.Path = r.URL.Path + ".br"
|
if isRequestingBrotliFile && acceptsEncodingBrotli(r) {
|
||||||
w.Header().Set("Content-Encoding", "br")
|
r.URL.Path = r.URL.Path + ".br"
|
||||||
w.Header().Set("Content-Type", contentType)
|
w.Header().Set("Content-Encoding", "br")
|
||||||
|
w.Header().Set("Content-Type", contentType)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
handler.ServeHTTP(w, r)
|
handler.ServeHTTP(w, r)
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user