if ($request_method = POST) { set $test P; } if ($http_cookie ~* "CCCC=.+(?:;|$)" ) { set $test "${test}C"; } if ($test = PC) { #rewrite rule goes here. }