testcookie-nginx-module
testcookie-nginx-module copied to clipboard
nginx-1.20.2 NOT WORK
###NOT WORK if ( $request ~* "my_log" ){ testcookie off; }
if ( $remote_addr = 111.11.11.111 ){ #return 308; testcookie off; } ###WORK if ( $request ~* "my_log" ){ #testcookie off; }
if ( $remote_addr = 111.11.11.111 ){ #return 308; #testcookie off; } testcookie off;
how testcookie off in IF... ?
Why are you dont want to use testcookie_whitelist
?
Why are you dont want to use
testcookie_whitelist
?
because whitelist not work
testcookie on/off can't be use in a if block
As described in the README you are suppose to use the testcookie_pass
option.
Like this:
map $remote_addr $is_allowed_ip {
1.1.1.1 1;
default 0;
}
testcookie_pass $is_allowed_ip;
In general you are discouraged to use if statements in nginx as maps are more performant.