NGINX 如何仅在上游缓存被命中时添加标头?

时间:2021-08-01 16:26:05

标签: nginx

我想添加标题。仅当上游缓存为 HIT 时

我在位置块中使用它但没有成功:

    if ($upstream_cache_status = "HIT") {
        expires 1m;
        add_header "X-Test-Header" "testvalue";
    }

使用 add_trailer 也不成功。有什么解决办法?

0 个答案:

没有答案