atom feed5 messages in ru.sysoev.nginxRe: 2 variables inside if() ?
FromSent OnAttachments
untamedOct 22, 2010 9:41 am 
António P. P. AlmeidaOct 22, 2010 10:41 am 
untamedOct 22, 2010 1:04 pm 
Maxim DouninOct 22, 2010 1:11 pm 
untamedOct 22, 2010 9:54 pm 
Subject:Re: 2 variables inside if() ?
From:António P. P. Almeida (ap@perusio.net)
Date:Oct 22, 2010 10:41:57 am
List:ru.sysoev.nginx

On 22 Out 2010 17h42 WEST, ngin@nginx.us wrote:

Hello,

I'm trying to compare 2 variables, like so (I've made sure the variables match):

[code]if ($arg_hash !~ $sha1) { ... }[/code]

However in error.log it says: [code]*1 "$sha1" does not match "a78c3ecd2e349d1f1050fa555842a60b585489d8"[/code]

I've tried swapping the variables over and the same error occurs, so it looks like the variable after the comparison character(s) is considered a string by nginx.

$sha1 is not set by Nginx during runtime. You've to set it in your config:

Ex: set $sha1 a78c3ecd2e349d1f1050fa555842a60b585489d8

Then compare them in your conditional.

Does anyone know of a way to do this? Or of a third party module which does this?

HTH, --- appa