nginx:对if使用指令

nginx:对if使用指令,nginx,Nginx,我想要有逻辑的: if ($do_not_cache) { fastcgi_pass_header "Set-Cookie"; } 但我得到了一个错误:“fastcgi\u pass\u header”指令在这里是不允许的 我试图为“fastcgi\u pass\u header”Set Cookie“”使用命名位置,但不知道如何在if部分中转发 我试图通过这种结构在位置上向前推进: if ($do_not_cache = 1) { rewrite ^(.*(?<!nginx_cache

我想要有逻辑的:

if ($do_not_cache) {
fastcgi_pass_header "Set-Cookie";
}
但我得到了一个错误:“fastcgi\u pass\u header”指令在这里是不允许的

我试图为“fastcgi\u pass\u header”Set Cookie“”使用命名位置,但不知道如何在if部分中转发

我试图通过这种结构在位置上向前推进:

if ($do_not_cache = 1) {
rewrite ^(.*(?<!nginx_cache))/$ https://$server_name$1?r=no_ cache permanent;
}
if($do\u not\u cache=1){
重写^(.*?
但它也不能正常工作