Welcome! Log In Create A New Profile

Advanced

Re: "proxy_intercept_errors on" with @location setup

Francis Daly
September 16, 2021 06:38PM
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.

> 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"?

> 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.


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,

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: 79
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready