The response head of the koa-chche-control plug-in introduced into the KOA framework does not work.

  node.js, question
var send = require('koa-send');
 var Koa = require('koa');
 var app = new Koa();
 var Router = require('koa-router');
 var cors = require('koa-cors');
 var koaBody = require('koa-body')();
 var cacheControl = require('koa-cache-control');
 var router = new Router({
 prefix: '/public'
 });
 app.use(gzip());
 app.use(cors())
 .use(router.routes())
 .use(router.allowedMethods());
 **app.use(cacheControl({
 maxAge: 500
 }));  **
 router.get('/:fname/:cname', koaBody, function*() {
 var fname = this.params.fname;
 var cname = this.params.cname;
 Log ("file type" plus fname);
 Log ("file name" plus cname);
 Yield send(this, "./public/ "plus fname plus"/"plus cname);
 })
 
 var port = 8003;
 app.listen(port);
 Log (`startup successful, port: ${port} `);

FireBug returned as follows
Return header, maxAge=0;
ccess-Control-Allow-Methods →GET,HEAD,PUT,POST,DELETE
Access-Control-Allow-Origin →*
Cache-Control →max-age=0
Connection →keep-alive
Content-Type →image/jpeg
Date →Thu, 22 Sep 2016 08:02:04 GMT
Last-Modified →Wed, 14 Sep 2016 07:42:52 GMT
Transfer-Encoding →chunked
content-encoding →gzip
I don’t know why max-age was set up and still didn’t show up when testing.
Attach plug-in addresshttps://github.com/DaMouse404 …, small white please comment

Because the location of your middleware is behind the route, it doesn’t reach cache-control at all. Just put it in front and revise it as follows

var send = require('koa-send');
 var Koa = require('koa');
 var app = new Koa();
 var Router = require('koa-router');
 var cors = require('koa-cors');
 var koaBody = require('koa-body')();
 var cacheControl = require('koa-cache-control');
 var router = new Router({
 prefix: '/public'
 });
 app.use(gzip());
 // put the middleware before your routers
 app.use(cacheControl({
 maxAge: 500
 }));
 app.use(cors())
 .use(router.routes())
 .use(router.allowedMethods());
 router.get('/:fname/:cname', koaBody, function*() {
 var fname = this.params.fname;
 var cname = this.params.cname;
 Log ("file type" plus fname);
 Log ("file name" plus cname);
 Yield send(this, "./public/ "plus fname plus"/"plus cname);
 })
 
 var port = 8003;
 app.listen(port);
 Log (`startup successful, port: ${port} `);