You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/middleware.md
+20-2Lines changed: 20 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -230,9 +230,27 @@ The following arguments are supported:
230
230
231
231
*`minimum_size` - Do not GZip responses that are smaller than this minimum size in bytes. Defaults to `500`.
232
232
*`compresslevel` - Used during GZip compression. It is an integer ranging from 1 to 9. Defaults to `9`. Lower value results in faster compression but larger file sizes, while higher value results in slower compression but smaller file sizes.
233
+
*`excluded_content_types` - A tuple of content type prefixes that should not be compressed. Defaults to `("text/event-stream", "application/zip", "application/gzip", "application/x-gzip", "image/", "video/", "audio/")`. You can customize this to add or remove content types as needed.
233
234
234
-
The middleware won't GZip responses that already have either a `Content-Encoding` set, to prevent them from
235
-
being encoded twice, or a `Content-Type` set to `text/event-stream`, to avoid compressing server-sent events.
235
+
The middleware won't GZip responses that:
236
+
237
+
* Already have a `Content-Encoding` set, to prevent them from being encoded twice
238
+
* Have a `Content-Type` that starts with any of the prefixes in `excluded_content_types`
239
+
240
+
By default, the following content types are excluded:
241
+
242
+
*`text/event-stream` - Server-sent events should not be compressed
0 commit comments