In the serveStatic middleware, there exists a check for compressible content types (in the COMPRESSIBLE_CONTENT_TYPE_REGEX)... if this check fails, then the compressed version of a file will never be served, even IF there does exist a compressed variant of that file!
While experimenting with using compression for a large binary file in one of my web projects, I found after analysing the network requests that the large file was not being served as a compressed Brotli file like it should have been (thus wasting precious network bandwidth and user time)!
When I saw that other files, like the actual .html were being served compressed, I had a hunch something was awry in the serveStatic middleware. After peeking the source code, I found that my hunch was correct, and renaming file from .bin to .txt (although technically incorrect) made Hono start serving the compressed version of the large file!
Considering that this behaviour is undocumented and could lead to user confusion, I ask that you document this somewhere.
In the serveStatic middleware, there exists a check for compressible content types (in the
COMPRESSIBLE_CONTENT_TYPE_REGEX)... if this check fails, then the compressed version of a file will never be served, even IF there does exist a compressed variant of that file!While experimenting with using compression for a large binary file in one of my web projects, I found after analysing the network requests that the large file was not being served as a compressed Brotli file like it should have been (thus wasting precious network bandwidth and user time)!
When I saw that other files, like the actual
.htmlwere being served compressed, I had a hunch something was awry in theserveStaticmiddleware. After peeking the source code, I found that my hunch was correct, and renaming file from.binto.txt(although technically incorrect) made Hono start serving the compressed version of the large file!Considering that this behaviour is undocumented and could lead to user confusion, I ask that you document this somewhere.