Skip to content

serve http: add gzip compression#9213

Merged
ncw merged 2 commits intorclone:masterfrom
acme:acme/server-http-gzip
Feb 26, 2026
Merged

serve http: add gzip compression#9213
ncw merged 2 commits intorclone:masterfrom
acme:acme/server-http-gzip

Conversation

@acme
Copy link
Copy Markdown
Contributor

@acme acme commented Feb 25, 2026

What is the purpose of this change?

Add gzip compression for directory listings and text assets served over HTTP.

This reduces the rclone repository file listing from 40 kB to 8 kB and reduces the rclone MANUAL.txt from 2.7 MB to 700 kB.

This makes listings and assets served across the network load faster.

The compression level of 5 should be a good balance between size and speed.

Was the change discussed in an issue or in the forum before?

#5786 from a while ago.

Checklist

  • I have read the contribution guidelines.
  • I have added tests for all changes in this PR if appropriate.
  • I have added documentation for the changes if appropriate.
  • All commit messages are in house style.
  • I'm done, this Pull Request is ready for review :-)

acme added 2 commits February 25, 2026 15:57
Add gzip compression for directory listings and text assets served over HTTP.

This reduces the rclone repository file listing from 40 kB to 8 kB and reduces
the rclone MANUAL.txt from 2.7 MB to 700 kB.

This makes listings and assets served across the network load faster.

The compression level of 5 should be a good balance between size and speed.
Copy link
Copy Markdown
Member

@ncw ncw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great thank you

I checked the chi source and this only attempts to compress things which might be compressible.

At some point we might controls for this but I think it shouldn't cause any problems.

https://github.com/go-chi/chi/blob/a54874f0e2f12647a19e82ee70dfa8185014100c/middleware/compress.go#L16

@ncw ncw merged commit 9be4fc8 into rclone:master Feb 26, 2026
9 checks passed
@acme
Copy link
Copy Markdown
Contributor Author

acme commented Feb 27, 2026

Indeed, I decided to stay with the defaults to keep it simpler.

@acme acme deleted the acme/server-http-gzip branch February 27, 2026 16:26
@acme
Copy link
Copy Markdown
Contributor Author

acme commented Mar 4, 2026

I submitted a small PR to chi to compress all text/* content-types: go-chi/chi#1057

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants