tywtyw2002
V2EX  ›  问与答

cdn中会缓存空白页面吗?

  •  
  •   tywtyw2002 · Oct 22, 2013 · 3097 views
    This topic created in 4691 days ago, the information mentioned may be changed or developed.
    upstream 因为错误或者其他原因返回 0 size的页面 with httpcode 200。
    这样的情况cdn提供商一般会去会缓存吗?


    如果自己用squid、nginx进行pass_proxy的话也会去缓存这个页面吗?
    squid设置了强制缓存该url,并且忽略?。
    3 replies    1970-01-01 08:00:00 +08:00
    tabris17
        1
    tabris17  
       Oct 22, 2013
    这个又没有标准,你可以程序中判断下Content-Length大小,等于0的话就返回500啊
    tywtyw2002
        2
    tywtyw2002  
    OP
       Oct 22, 2013
    @tabris17 目前无法去控制upstream的返回。。。。。
    如果纯nginx的话可否判断 content-length == 0 呢?
    如果是0 直接跳500,nginx的缓存机制也是建立在成功的基础上,所以在他缓存之前跳就好了。。。。
    ine181x
        3
    ine181x  
       Oct 22, 2013
    看你自己需求了 不过 content-length=0 的 resopnse 也是存在的,比如心跳检测 API 。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3584 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 10:36 · PVG 18:36 · LAX 03:36 · JFK 06:36
    ♥ Do have faith in what you're doing.