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 · 4955 views
    This topic created in 4467 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   ·   3112 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 52ms · UTC 06:25 · PVG 14:25 · LAX 23:25 · JFK 02:25
    ♥ Do have faith in what you're doing.