https://github.com/rushiimachine/caddy-deflate
A caddy plugin that adds a deflate compression encoder for caddy.
https://github.com/rushiimachine/caddy-deflate
Last synced: 10 months ago
JSON representation
A caddy plugin that adds a deflate compression encoder for caddy.
- Host: GitHub
- URL: https://github.com/rushiimachine/caddy-deflate
- Owner: rushiiMachine
- License: apache-2.0
- Created: 2023-08-23T20:47:09.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2025-01-01T18:33:04.000Z (over 1 year ago)
- Last Synced: 2025-03-19T22:11:34.669Z (about 1 year ago)
- Language: Go
- Size: 70.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# caddy-deflate
A caddy plugin that adds support for HTTP's `Accept-Encoding: deflate` for caddy.
**Note:** This follows the official definition for http `deflate`, that being a deflate stream wrapped with zlib, not a
raw deflate stream! (many implementations have made this mistake)
## Building with xcaddy
```shell
xcaddy build \
--with github.com/rushiiMachine/caddy-deflate
```
## Samples
The [encode](https://caddyserver.com/docs/caddyfile/directives/encode) directive will have a new format
named `deflate`.\
Valid compression levels are listed
[here](https://github.com/klauspost/compress/blob/0836a1cac5461da096074c0125c507f1b3fc0fdb/flate/deflate.go#L17-L31)
otherwise any value in the range `[0-9]`.
```caddyfile
:80 {
encode deflate
file_server
}
```
or
```caddyfile
:80 {
# Use multiple compressors
encode deflate gzip zstd
file_server
}
```
or
```caddyfile
:80 {
encode {
# Configure the compression level
deflate 4
# Configure another backup compressor
gzip
}
file_server
}
```