3 ms·
With the rewrite and map blocks it is maybe a little easier for you to write fewer if statements…. https://stackoverflow.com/questions/47724946/nginx-rewrite-by
by taf2 5y ago
With the rewrite and map blocks it is maybe a little easier for you to write fewer if statements….
https://stackoverflow.com/questions/47724946/nginx-rewrite-by-map-with-parameters https://stackoverflow.com/questions/47724946/nginx-rewrite-b...
- nkozyra 5y agoOh I've used these plenty but there are still conditionals which sometimes require or are most clearly defined with if statements, particularly complex redirects that rely on a number of individual conditions to be met. I've seen these manifest in the wild as stuff like: if ($thing ~* (match)) { $setWeirdVar = "Y"; } if ($otherThing = "value") { set $setValue "${setWeirdVar}E"; } if ($thirdCondition ~ (another|match)) { set $setValue "${setWeirdVar}S"; } if ($setValue = YES) { # do a thing here } As clunky as that is, I've found it recommended in SO threads.