Welcome! Log In Create A New Profile

Advanced

Re: why "if" can not be used within "if"?

merlin corey
July 25, 2009 07:50AM
2009/7/24 Igor Sysoev <is@rambler-co.ru>:
> Currently "if" is ugly hack.

To very slightly expand upon what Igor said, here is my understanding.
If is an ugly hack that essentially (within a location, anyway) is
actually another psuedo-location (I think you'll see this too if you
look into code more). On the flip side, this means many ifs can (and
should) be replaced by use of location directives in combination with
try_files directives. Finally, and a little more philosophically, in
general the nginx configuration is a nice declarative statement about
your sites' layouts; on the other hand, "if" is an imperative
statement that breaks from this flow and is somewhat out of place.

Unfortunately, currently, there are some things you can only do with
an if. For those cases, I ask you, do you really want a much more
complicated configuration? Seems to me simplest is best, especially
when you have to use if! Debugging issues with ifs I remember being
not a lot of fun in 0.6.x - try_files made it so I don't have to do
that anymore in 0.7.x and above and I am happier for it! Good luck,
nonetheless.

-- Merlin
Subject Author Posted

why "if" can not be used within "if"?

climbor July 24, 2009 05:06AM

Re: why "if" can not be used within "if"?

Igor Sysoev July 24, 2009 06:51AM

Re: why "if" can not be used within "if"?

merlin corey July 25, 2009 07:50AM

Re: why "if" can not be used within "if"?

climbor July 26, 2009 10:57PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 220
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready