Skip to content

Commit b119be5

Browse files
Add docs from gofiber/fiber@6d1f7b2
1 parent b4edd9e commit b119be5

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

docs/core/middleware/compress.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ Compression middleware for [Fiber](https://github.com/gofiber/fiber) that automa
1010
Bodies smaller than 200 bytes remain uncompressed because compression would likely increase their size and waste CPU cycles. [See the fasthttp source](https://github.com/valyala/fasthttp/blob/497922a21ef4b314f393887e9c6147b8c3e3eda4/http.go#L1713-L1715).
1111
:::
1212

13+
## Behavior
14+
15+
- Skips compression for responses that already define `Content-Encoding`, for range requests, `206` responses, status codes without bodies, or when either side sends `Cache-Control: no-transform`.
16+
- `HEAD` requests negotiate compression so `Content-Encoding`, `Content-Length`, `ETag`, and `Vary` reflect the encoded representation, but the body is removed before sending.
17+
- When compression runs, strong `ETag` values are recomputed from the compressed bytes; when skipped, `Accept-Encoding` is still merged into `Vary` unless the header is `*` or already present.
18+
1319
## Signatures
1420

1521
```go

docs/core/whats_new.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1182,7 +1182,11 @@ We've updated several fields from a single string (containing comma-separated va
11821182

11831183
### Compression
11841184

1185-
We've added support for `zstd` compression on top of `gzip`, `deflate`, and `brotli`.
1185+
- Added support for `zstd` compression alongside `gzip`, `deflate`, and `brotli`.
1186+
- Strong `ETag` values are now recomputed for compressed payloads so validators remain accurate.
1187+
- Compression is bypassed for responses that already specify `Content-Encoding`, for range requests or `206` statuses, and when either side sends `Cache-Control: no-transform`.
1188+
- `HEAD` requests still negotiate compression so `Content-Encoding`, `Content-Length`, `ETag`, and `Vary` match a corresponding `GET`, but the body is omitted.
1189+
- `Vary: Accept-Encoding` is merged into responses even when compression is skipped, preventing caches from mixing encoded and unencoded variants.
11861190

11871191
### CSRF
11881192

0 commit comments

Comments
 (0)