V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
NGINX
NGINX Trac
3rd Party Modules
Security Advisories
CHANGES
OpenResty
ngx_lua
Tengine
在线学习资源
NGINX 开发从入门到精通
NGINX Modules
ngx_echo
JasonH
V2EX  ›  NGINX

nginx 里应该怎么判断 upstream 是否给出了 cache-control 头?

  •  
  •   JasonH · Feb 27, 2014 · 4904 views
    This topic created in 4443 days ago, the information mentioned may be changed or developed.
    1 replies    1970-01-01 08:00:00 +08:00
    Livid
        1
    Livid  
    MOD
    PRO
       Feb 27, 2014
    header_filter_by_lua '
    if ngx.var.upstream_http_cache_control then
    ngx.header["Cache-Control"] = ngx.var.upstream_http_cache_control
    else
    ngx.header["Cache-Control"] = "no-store"
    end
    ';

    你可以把 else 那里换成你想干的事。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3920 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 10:25 · PVG 18:25 · LAX 03:25 · JFK 06:25
    ♥ Do have faith in what you're doing.