Welcome! Log In Create A New Profile

Advanced

Re: Allowing the etag directive within if in location

Maxim Dounin
November 26, 2022 04:08PM
Hello!

On Sun, Nov 27, 2022 at 02:31:20AM +0800, Danila Vershinin wrote:

> Thank you for the answer. A more generic question follows:
>
> While we understand that IfIsEvil mostly applies to "being evil inside
> location context."...
>
> We notice some directives allow being placed within "if in location" but
> not within "if" in the server context.
>
> An example is gzip module's main directive:
> http://nginx.org/en/docs/http/ngx_http_gzip_module.html#gzip
>
> Context: http, server, location, if in location
>
> So "gzip on" can be done in "if in location", but NGINX does not allow this
> to be done in just "if" (which seems not an "evil" thing to do).
>
> Is there a specific rationale for why many NGINX directives are not allowed
> in server-level "if" but are allowed in "if in location"?
>
> Consequentially, is there any problem in allowing server-level `if` context
> for such directives by adding corresponding flags?
> And is there are problem in doing the same for directives that doesn't
> support any kind of "if" (neither `if` in server nor `if in location`),
> like `gzip_proxied` directive?

In the server context, only rewrite directives are allowed
inside "if", and "if" works as it should: just provides an
conditional operator within the rewrite module instructions, and
does not try to create an implicit location configuration.

For obvious reasons you can't just allow non-rewrite directives
within server-level "if" blocks: you have to make them work
somehow. Trying to do so will likely create even bigger issues
than the current if-in-location problems.

Summing the above: yes, there is a problem.

--
Maxim Dounin
http://mdounin.ru/
_______________________________________________
nginx-devel mailing list -- nginx-devel@nginx.org
To unsubscribe send an email to nginx-devel-leave@nginx.org
Subject Author Views Posted

Allowing the etag directive within if in location

Danila Vershinin 372 November 26, 2022 12:04PM

Re: Allowing the etag directive within if in location

Maxim Dounin 135 November 26, 2022 12:38PM

Re: Allowing the etag directive within if in location

Danila Vershinin 136 November 26, 2022 01:32PM

Re: Allowing the etag directive within if in location

Maxim Dounin 219 November 26, 2022 04:08PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

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