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.
Summary
Please consider adding static pre-compressed file serving to uhttpd: when a request for
foo.cssarrives withAccept-Encoding: gzipand a sibling filefoo.css.gzexists on disk, serve the.gzbytes verbatim withContent-Encoding: gzipand the original file'sContent-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:
Shipping the
.gzsibling would cut the transfer size of these assets by roughly an order of magnitude, with no added request-time cost to the router.