Welcome! Log In Create A New Profile

Advanced

Re: Keep Alive piles up

Maxim Dounin
July 16, 2009 12:20PM
Hello!

On Thu, Jul 16, 2009 at 11:55:38AM +0200, Toni Mueller wrote:

>
> Hello!
>
> On Tue, 30.06.2009 at 00:18:57 +0400, Maxim Dounin <mdounin@mdounin.ru> wrote:
> > Looks like you assume that wiki == documentation. It's simply not
> > true.
>
> it seems that for those of us who can't read russian, it simply has to
> be true because we don't have much of a choice.

It's probably a good idea to maintain translation of
documentation somewhere, may be just change wiki policy for
generic pages. For now, feel free to use google translate or
yahoo babelfish.

> > Yes, nested locations have drawbacks due to some inheritance bugs
> > (and hence they still aren't documented in official docs). But
> > if's are in fact nested locations under the hood - and they have
>
> I have trouble understanding how if()s can be locations under the hood,
> or how I could use variable testing (like eg. in geo-ip) without if()s.

Looks like statements for me, not questions. Anyway, here is some
explanations:

1. Directive if() used inside location creates another location
configuration object via ngx_http_add_location() (and then it's
used in case if() condition passes), see
src/http/modules/ngx_http_rewrite_module.c:ngx_http_rewrite_if()
for details.

2. In some cases you can avoid using if()'s. In some you can't.
If you can - in most cases it's better choice to avoid. If you
can't - it's somethimes better to avoid the whole case then to use
if().

Normally if's will work. But somethimes they produce unexpected
results or even coredumps. The bad thing is that previously good
configuration that uses if's may be rendered invalid just by
adding some minor unrelated directives (or vice versa, good
configuration without if's may be rendered invalid by adding
unrelated if's). Here are some examples:

1.

Good, try_files working as expected:

location /try-files {
try_files /file @fallback;
}

Bad, try_files not working at all:

location /if-try-files {
try_files /file @fallback;

set $true 1;

if ($true) {
# nothing
}
}

2.

Good, works as expected:

location /no-crash {

set $true 1;

if ($true) {
# fastcgi_pass here
fastcgi_pass 127.0.0.1:9000;
}
}

Bad, crashes:

location /crash {

set $true 1;

if ($true) {
# fastcgi_pass here
fastcgi_pass 127.0.0.1:9000;
}

if ($true) {
# no handler here
}
}

The other bad thing - it's not clear how to fix this without
breaking compatibility.

Note that if() used inside server{} block and if() used inside
location block are quite a different beasts. While the former is
limited to safe things and mostly harmless - latter is evil. On
the other hand, using server-scope if's is just inefficient if you
need them only for some specific location.

Maxim Dounin
Subject Author Posted

Keep Alive piles up

meto June 25, 2009 10:07AM

Re: Keep Alive piles up

Maxim Dounin June 25, 2009 12:33PM

Re: Keep Alive piles up

meto June 25, 2009 03:49PM

Re: Keep Alive piles up

Maxim Dounin June 25, 2009 05:10PM

Re: Keep Alive piles up

meto June 25, 2009 06:25PM

Re: Keep Alive piles up

Maxim Dounin June 25, 2009 07:47PM

Re: Keep Alive piles up

meto June 26, 2009 02:00AM

Re: Keep Alive piles up

meto June 26, 2009 08:02AM

Re: Keep Alive piles up

meto June 26, 2009 09:06AM

Re: Keep Alive piles up

Grzegorz Nosek June 26, 2009 09:19AM

Re: Keep Alive piles up

meto June 26, 2009 09:53AM

Re: Keep Alive piles up

Grzegorz Nosek June 26, 2009 10:17AM

Re: Keep Alive piles up

meto June 26, 2009 10:43AM

Re: Keep Alive piles up

meto June 26, 2009 01:17PM

Re: Keep Alive piles up

Grzegorz Nosek June 26, 2009 02:03PM

Re: Keep Alive piles up

meto June 26, 2009 02:42PM

Re: Keep Alive piles up

meto June 26, 2009 03:03PM

Re: Keep Alive piles up

meto June 26, 2009 03:54PM

Re: Keep Alive piles up

Grzegorz Nosek June 26, 2009 04:04PM

Re: Keep Alive piles up

meto June 26, 2009 06:10PM

Re: Keep Alive piles up

meto June 26, 2009 06:29PM

Re: Keep Alive piles up

Grzegorz Nosek June 27, 2009 04:23AM

Re: Keep Alive piles up

meto June 27, 2009 06:02AM

Re: Keep Alive piles up

Grzegorz Nosek June 27, 2009 06:50AM

Re: Keep Alive piles up

meto June 27, 2009 07:34AM

Re: Keep Alive piles up

meto June 27, 2009 07:40AM

Re: Keep Alive piles up

meto June 27, 2009 08:48AM

Re: Keep Alive piles up

Tomasz Pajor June 28, 2009 03:58AM

Re: Keep Alive piles up

meto June 28, 2009 05:29AM

Re: Keep Alive piles up

Maxim Dounin June 29, 2009 06:38AM

Re: Keep Alive piles up

meto June 29, 2009 09:43AM

Re: Keep Alive piles up

meto June 29, 2009 10:18AM

Re: Keep Alive piles up

Maxim Dounin June 29, 2009 11:55AM

Re: Keep Alive piles up

Maxim Dounin June 29, 2009 10:46AM

Re: Keep Alive piles up

meto June 29, 2009 11:32AM

Re: Keep Alive piles up

meto June 29, 2009 11:34AM

Re: Keep Alive piles up

Maxim Dounin June 29, 2009 12:10PM

Re: Keep Alive piles up

meto June 29, 2009 01:00PM

Re: Keep Alive piles up

Maxim Dounin June 29, 2009 02:21PM

Re: Keep Alive piles up

meto June 29, 2009 03:27PM

Re: Keep Alive piles up

Maxim Dounin June 29, 2009 04:18PM

Re: Keep Alive piles up

Toni Mueller July 16, 2009 05:55AM

Re: Keep Alive piles up

Maxim Dounin July 16, 2009 12:20PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 208
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