Matching on two conditions
sean at monkeysnatchbanana.com
Wed Oct 1 17:59:39 MSD 2008
On Oct 1, 2008, at 3:34 AM, Pål-Kristian Hamre wrote:
> Anyway, our problem is that we need to match both $request_method and
> $remote_addr before doing a rewrite. Have any of you run into the same
> problem and found a solution for it?
We have to do this in a couple places and the solution I came up with
but it works.
Here comes the ugly:
set $conditionA 0;
set $conditionB 0;
if ( $request_method ... )
set $conditionA 1;
if ( $remote_addr ... )
set $conditionB 1;
set $dual_test "$conditionA:$conditionB"
if ( $dual_test = '1:1' )
# both conditions match
More information about the nginx