【发布时间】:2017-12-10 06:26:12
【问题描述】:
我有一个在 Woocommerce 上运行的 WordPress 安装,它需要 GET 请求 add_to_cart 才能运行,以便用户将商品添加到购物车。
我有类似的 FastCGI 缓存键 How to set fastcgi_cache_key using original $request_uri without $args?
# Map request_path var without query strings
map $request_uri $request_path {
~(?<captured_path>[^?]*) $captured_path;
}
# FastCGI Cache
fastcgi_cache_path /var/run/nginx-cache levels=1:2 keys_zone=WORDPRESS:100m inactive=60m;
fastcgi_cache_key "$scheme$request_method$host$request_path$cookie_aelia_cs_selected_currency";
有没有办法绕过 FastCGI 处理这些请求,让 NGINX 只为页面提供服务?
我对 NGINX 还是很陌生,因此非常感谢任何帮助
更新
我尝试在服务器块中使用以下内容
if ($arg_name ~* "(add-to-cart|remove-item)") {
set $no_cache 1;
}
服务器仍然忽略这一点并提供缓存文件。
现已解决
【问题讨论】: