express-static-gzip icon indicating copy to clipboard operation
express-static-gzip copied to clipboard

Ensure Https protocol for serving brotli

Open nksfrank opened this issue 2 years ago • 1 comments

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?

nksfrank avatar May 07 '22 06:05 nksfrank

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");

tkoenig89 avatar May 11 '22 06:05 tkoenig89