Feature request: serve pre-compressed static files (`gzip_static`)
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 35
- Forks
- 29
- PR merge metrics
- No merged PRs in 30d
Description
Summary
Please consider adding static pre-compressed file serving to uhttpd: when a request for foo.css arrives with Accept-Encoding: gzip and a sibling file foo.css.gz exists on disk, serve the .gz bytes verbatim with Content-Encoding: gzip and the original file's Content-Type.
This is not on-the-fly (dynamic) compression. It simply hands back an already-compressed file that the developer/build system produced ahead of time. Request-time CPU cost is therefore lower than serving the uncompressed file (fewer bytes pushed through the network stack), not higher — which keeps it in line with uhttpd's goal of being a minimal, low-overhead server for constrained devices.
Use case
I'm developing a modern LuCI theme. It's built with Tailwind CSS, which — even after tree-shaking and minification — emits a fairly large stylesheet because of the volume of utility classes and generated custom properties the design relies on. The result is highly repetitive text, which is close to the ideal case for gzip.
Measured on my theme's production build:
| File | Raw (bytes) | gzip -9 (bytes) | Saving |
|---|---|---|---|
| main.css | 211,725 | 27,808 | −87% |
| login.css | 30,498 | 6,604 | −78% |
| menu-aurora.js | 17,348 | 4,604 | −73% |
Shipping the .gz sibling would cut the transfer size of these assets by roughly an order of magnitude, with no added request-time cost to the router.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing uhttpd's static-file request path and its handling of Accept-Encoding and Content-Type. Implement sibling .gz selection only when gzip is accepted, preserve the original file's type, and verify that uncompressed serving remains unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- backend, performance
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 56/100