nginx剔除指定cookie
location ^~ / {
# 保存原始 "Cookie" 頭值
set $altered_cookie $http_cookie;
# 使用正則檢查并剔除 "$Path=/" 部分
if ($http_cookie ~ '(.*?);?\s*\$Path="/"([^;]*)') {
# 在這里,$1 是 "$Path=/" 前的部分,$2 是后面的部分
set $altered_cookie $1$2; # 重新設置不包含 "$Path=/" 的新值
}
# 隱藏原始 "Cookie" 頭
proxy_hide_header Cookie; #這里一定要加?。。?
# 設置 "Cookie" 頭為新值
proxy_set_header Cookie $altered_cookie;
}

浙公網安備 33010602011771號