Welcome! Log In Create A New Profile

Advanced

Re: "proxy_intercept_errors on" with @location setup

Francis Daly
September 18, 2021 03:36AM
On Fri, Sep 17, 2021 at 02:36:11PM -0300, Fabiano Furtado Pessoa Coelho wrote:
> On Thu, Sep 16, 2021 at 7:37 PM Francis Daly wrote:
> > On Thu, Sep 16, 2021 at 04:25:59PM -0300, Fabiano Furtado Pessoa Coelho wrote:

Hi there,

> > > The only valid configuration I've found to intercept errors is not
> > > using the @location but I want to use it to simplify the
> > > configuration.
> >
> > Depending on how you understand "simplify" -- you could potentially
> > "include" a file with the common pieces and just have the unique
> > directives in each location{}; or you could put the common pieces (apart
> > from proxy_pass) outside the location{}s, and just have the unique
> > directives and proxy_pass inside the location{}s (note: your current
> > example has the same set of proxy_set_header directives in each
> > location{}, so this can work); or potentially you could use an external
> > macro-processing tool to generate your complicated nginx.conf from
> > whatever simplified input you want to use.
>
> I think I will "put the common pieces (apart from proxy_pass) outside
> the location{}s".
> This is the best config for me!

Good to hear that you found a configuration that works for you :-)

Once you understand how nginx uses its config, and how directive
inheritance works, then you won't be surprised by the behaviour you
configured.

(With a few exceptions, often related to the rewrite module, the general
pattern is: one request is handled in one location{}; and each directive
*not* explicit in that location either inherits from the surrounding
context, or does not inherit at all. And a directive is something like
"proxy_set_header", not "proxy_set_header X-Real-IP".)

Good luck with it,

f
--
Francis Daly francis@daoine.org
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

"proxy_intercept_errors on" with @location setup

Fabiano Furtado Pessoa Coelho September 16, 2021 03:28PM

Re: "proxy_intercept_errors on" with @location setup

Francis Daly September 16, 2021 06:38PM

Re: "proxy_intercept_errors on" with @location setup

Fabiano Furtado Pessoa Coelho September 17, 2021 01:38PM

Re: "proxy_intercept_errors on" with @location setup

Francis Daly September 18, 2021 03:36AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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