No cache in Node.js server

前端 未结 6 768
北荒
北荒 2020-12-14 05:34

I have read that to avoid caching in Node.js, it is necessary to use:

res.header(\'Cache-Control\', \'no-cache, private         


        
6条回答
  •  悲哀的现实
    2020-12-14 06:19

    You can use nocache Middleware to turn off caching.

    npm install --save nocache
    

    Apply the middleware to your app

    const nocache = require('nocache');
    ...
    app.use(nocache());
    

    This disables browser caching.

提交回复
热议问题