koajs / static

Static file server middleware

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Gzip has no effect.

fengshenhai-0727 opened this issue · comments

Gzip has no effect.
commented

same here, any solution ?

koa-static/koa-send only try to serve the gzipped version of a file automatically when gzip is supported by a client and if the requested file with .gz extension exists.

So, what you guys mean Gzip has no effect ?

image
It's mean file was sent without gzip effect (gz file is only 45kb but it's send 127kb un-gzip)
image
Look at response header also not have 'content-encoding': 'gzip'
image

Here is the correct one

It will only send an existing gzipped version of a file. If you want to compress on the fly you should use koa-compress.

In other words, if you provide a file foo.ext and foo.ext.gz, the foo.ext.gz will be served if the gzip option is true and a client asks for a gzipped version.

It's a good practice to always provide a gzipped version for all text assets (js, css) and fonts except the ones already gzipped.

@haoxins
I have the same problem while having .gz and .br files
image

and browser network info
image

server doesnt respond with gzip or brotli version