【发布时间】:2019-09-11 04:23:56
【问题描述】:
我正在尝试根据响应标头缓存请求。 现在我想要的条件是,如果响应同时具有 2 个标头 client-device 和 client-location,那么响应应该缓存在 nginx 端
所以我尝试了这段代码
if ($http_client_device && $http_clocation) {
set $cache_key "$request_uri$http_client_device$http_client_location";
}
proxy_cache_key $cache_key;
但是 nginx 不允许这样做 nginx:[emerg] 出现意外的“&&”...
无论如何要解决这个问题? 提前谢谢
【问题讨论】:
标签: if-statement nginx and-operator