Support serving pre-compressed files for static sites#2615
Merged
JohnTitor merged 7 commits intoactix:mainfrom Feb 8, 2026
Merged
Support serving pre-compressed files for static sites#2615JohnTitor merged 7 commits intoactix:mainfrom
JohnTitor merged 7 commits intoactix:mainfrom
Conversation
04e21f2 to
15fb3a5
Compare
15fb3a5 to
0e4d3b5
Compare
Contributor
Author
|
After some reflection, I've realized there's no reason to tie the supported precompression formats here to the supported runtime compression formats in I've pushed those changes. |
|
@robjtede miniserve depends on actix-files and would really benefit from this PR merging. Is there something blocking its review? |
Member
|
Just time allocation. Reviews from interested parties will help massively. |
JohnTitor
approved these changes
Feb 8, 2026
Member
JohnTitor
left a comment
There was a problem hiding this comment.
Thank you for the PR and sorry for the delay!
LGTM with some tweaks.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Type
Feature
PR Checklist
Overview
This PR adds the
Files::try_compressed()builder method. If a static files service is constructed with that method, each incoming request will automatically check for a pre-compressed.gz,.br, or.zstfile on disk, in order of preference according to theAccept-Encodingheader, before falling back to the normal uncompressed file. When a compressed file is selected, theContent-Encodingheader is populated with the respective compression type, while theContent-TypeandContent-Dispositionfields retain the original file's values.There should be no breaking changes here,
although I've had to expose some fields in ways that may not be ideal (I'm looking at theResolved, see #2615 (comment)SUPPORTED_ENCODINGSlist in particular, and perhaps the new features I've copied straight fromactix-web- let me know if you have a better idea of how to structure any of that!).Closes #2415