koajs / static

Static file server middleware

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sending invalid gzip/br response

userquin opened this issue · comments

I'm integrating koa-static with vuejs 3 and vite: internally using koa on its own es-dev-server.

const serve = require("koa-static");

const viteConfig = <UserConfig>{
    configureServer: <ServerPlugin>({
        root, // project root directory, absolute path
        app, // Koa app instance
    }) => {
        console.info(root);
        const koaStatic = serve(root, {
            index: true,
            defer: false,
            hidden: false,
            extensions: ["css", "html", "js", "png", "ico", "svg"]
        });
        app.use(async (ctx, next) => {
            await koaStatic(ctx, next);
        });
    },
    ...
};

First I'm trying to only serve gzip files but the content that is served is the original, I'm getting bad encoding response.

Also failing with br.

koa-static-error

koa-static-response-headers

koa-static-index-html-br

it seems vite problem