I know its possible to escape | in normal regular expressions by preceding a \. But it seems in nginx config files this is not working as expected:
# Don't use the cache only for these users: (user1 & user2)
if ($http_cookie ~* "wordpress_logged_in_.+=(user1|user2)\|.+") {
set $no_cache 1;
set $bypass_cache 1;
}
but in above code it seems nginx is not escaping | and its matching .* because | is considered as regex OR command.