From 2f0b77f45b8df1db6e12b0fee5d261f2638a65da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Fri, 25 Mar 2022 16:09:31 +0100 Subject: [PATCH] Manager: disable GZip middleware, as it causes some issues Apparently a "204 No Content" response will still get GZip-compressed. --- cmd/flamenco-manager/main.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/cmd/flamenco-manager/main.go b/cmd/flamenco-manager/main.go index 3b04ea4a..0eb9bc64 100644 --- a/cmd/flamenco-manager/main.go +++ b/cmd/flamenco-manager/main.go @@ -158,7 +158,18 @@ func buildWebService( // Ensure panics when serving a web request won't bring down the server. e.Use(middleware.Recover()) - e.Use(middleware.Gzip()) + + // Disabled, as it causes issues with "204 No Content" responses. + // TODO: investigate & file a bug report. Adding the check on an empty slice + // seems to fix it: + // + // func (w *gzipResponseWriter) Write(b []byte) (int, error) { + // if len(b) == 0 { + // return 0, nil + // } + // ... original code of the function ... + // } + // e.Use(middleware.Gzip()) // Load the API definition and enable validation & authentication checks. swagger, err := api.GetSwagger()