Welcome! Log In Create A New Profile

Advanced

Re: limit_req is not working in virutal location?

Maxim Dounin
January 11, 2018 01:16PM
Hello!

On Thu, Jan 11, 2018 at 12:22:56PM -0500, pva wrote:

> Hi, Maxim.
>
> Maxim Dounin Wrote:
> > That's because try_files is not a mechanism to "conditionally select
> > configurations"[1] like the rewrite module directives (including
> > "return"), but rather a way to choose which file will be used for
> > request processing. As such, try_files checks happen right before
> > actually returning the response, after various access checks and
> > limits.
>
> I see, thank you. Do I understand correctly, that the following example in
> documentation
> https://nginx.ru/en/docs/http/ngx_http_core_module.html#try_files
> is not strictly correct:
>
> ---------------------------------------------------------------------
> In the following example,
>
> location / {
> try_files $uri $uri/ @drupal;
> }
>
> the try_files directive is equivalent to
>
> location / {
> error_page 404 = @drupal;
> log_not_found off;
> }
> ---------------------------------------------------------------------
>
> These directives are not equivalent since limits are not applied in the
> second case. Right?

No, there are actually more or less equivalent. There a minor
differences - try_files version will do an extra syscall, while
error_page version will make further error processing harder as
recursive error pages are disabled by default. But in both cases
all access checks and limits will be applied before testing or
opening the file.

You probably misunderstood how error_page version works. It
actually tries to return the file requested, and all limits and
access checks happen before this. If there is no file and so
open()ing it fails, the 404 Not Found error is generated. Then
404 is handled according to error_page, and the request is
internally redirected to the @drupal location for further
processing. See http://nginx.org/r/error_page for details.

--
Maxim Dounin
http://mdounin.ru/
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

limit_req is not working in virutal location?

pva January 11, 2018 03:32AM

Re: limit_req is not working in virutal location?

Francis Daly January 11, 2018 08:14AM

Re: limit_req is not working in virutal location?

pva January 11, 2018 10:47AM

Re: limit_req is not working in virutal location?

Maxim Dounin January 11, 2018 10:58AM

Re: limit_req is not working in virutal location?

pva January 11, 2018 12:22PM

Re: limit_req is not working in virutal location?

Maxim Dounin January 11, 2018 01:16PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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