express-static-gzip
express-static-gzip copied to clipboard
Ensure Https protocol for serving brotli
one of the requirements for serving brotli encryption is a https protocol.
right now, when setting up express-static-gzip
with brotli enabled, any request not over https fails.
would it be possible to verify req
protocol is https
before trying to serve .br
files?
I have thought about this in the past already, and decided, that enforcing a protocol is not the task of this middlware. As express-static-gzip
supports multiple/any comporessions the developer should be responsible for prerequisits that come with any of these.
Specific on your https case, i wonder why not always use https and therefore enforce it on all endpoints as https has become the defacto standard since the snowden revelations.
If you just want to ensure compressed files are send on https i would recommend adding a simple 'middleware' on top. For example like this pseudo code example:
app.use("/files", () => ensureHttps());
app.use("/files", expressStaticGzip");