But my-other-middleware rewrites the response (e.g. any css file has the same contents - of the main page). So I try to put an alternate route like this:
my-other-middleware = async (ctx, next) => {
switch (ctx.url.substr(0, 4)) {
case '/css':
case '/js/':
case '/img':
return
// or return next()
// or next(); return — nothing helps
}
...
}
So, for the "static" directories the response shouldn't get rewritten. But then I get 404 'Not Found' for any file which actually exist — e.g.
I don't even know how to debug it. Am I doing something wrong, or maybe it's just some incompatibility in my software stack? Bear with a noob question please.
Update: on Linux server it happens too.
I'm trying to figure out how to use koa-static (in SPA) properly.
First I just had put it in front of the other middleware, hoping that when it finds a file it would immediately return serving it:
But
my-other-middleware
rewrites the response (e.g. any css file has the same contents - of the main page). So I try to put an alternate route like this:So, for the "static" directories the response shouldn't get rewritten. But then I get 404 'Not Found' for any file which actually exist — e.g.
I don't even know how to debug it. Am I doing something wrong, or maybe it's just some incompatibility in my software stack? Bear with a noob question please.
Thank you.