testcookie-nginx-module icon indicating copy to clipboard operation
testcookie-nginx-module copied to clipboard

nginx-1.20.2 NOT WORK

Open cshost1 opened this issue 1 year ago • 3 comments

###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... ?

cshost1 avatar Apr 14 '23 20:04 cshost1

Why are you dont want to use testcookie_whitelist?

GrayHoax avatar Oct 13 '23 06:10 GrayHoax

Why are you dont want to use testcookie_whitelist?

because whitelist not work

cshost1 avatar Oct 13 '23 21:10 cshost1

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.

alyxto avatar Feb 01 '24 11:02 alyxto