Good to know, but invest some time to convert this into a map (https://www.google.nl/#q=nginx+map+regex) because even-though 'if' is very powerful it should only be used to stop handling a request.
if (...) { return ... } is ok because the location block exits.
if (...) { set x y; set a b; ... } is not ok because in some weird cases 'set a b' can run before 'set x y'.
Just doing a 'set' (with values from map) is ok.
---
nginx for Windows http://nginx-win.ecsds.eu/