"proxy_intercept_errors on" with @location setup
Fabiano Furtado Pessoa Coelho
fusca14 at gmail.com
Fri Sep 17 17:36:11 UTC 2021
Hi Francis...
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,
>
> > Is it possible to use "proxy_intercept_errors on" with @location?
>
> Yes; but it is only useful if "proxy_pass" sees the
> "proxy_intercept_errors". Which means: if the config directives are in,
> or are inherited into, the location{} where the request is handled.
I understood!
> > Invalid config:
>
> This looks like valid nginx config to me.
>
> I guess you mean "does not do what I want", rather than "is rejected by
> nginx as invalid"?
I mean... "does not do what I want". ;)
> > 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!
> In general, nginx's config is fast for nginx to read and process; it
> does not particularly try to be compact for people to write if there
> are different configs wanted.
>
>
> Hopefully you'll find a config setup that you're happy with.
>
> Cheers,
Thank you!
More information about the nginx
mailing list