zoukankan      html  css  js  c++  java
  • node express 304 avoid

    method 1

    Why do I need this? The right answer is: I don’t need that trick!

    The example below is just to show how to use routes to intercept requests to a static file.

    Put router before static.

    app.use(app.router);
    app.use(express.static(__dirname + '/static'));

    Add ‘/*’ handler (don’t forget to call next())

    app.get('/*', function(req, res, next){ 
      res.setHeader('Last-Modified', (new Date()).toUTCString());
      next(); 
    });


    method 2()

    app.use(function(req, res, next){
    res.header("Cache-Control", "no-cache, no-store, must-revalidate");
    res.header("Pragma", "no-cache");
    res.header("Expires", 0);
    next();
    });

    method 3

    Easiest solution:

    app.disable('etag');
  • 相关阅读:
    The Best Seat in ACM Contest
    确定比赛名次
    Red and Black
    Can you find it?
    胜利大逃亡
    Reward
    DXUT编译指南(转)
    逐顶点和逐像素光照
    转战DX
    hlsl之ambient
  • 原文地址:https://www.cnblogs.com/voctrals/p/5416367.html
Copyright © 2011-2022 走看看