"proxy_intercept_errors on" with @location setup

Fabiano Furtado Pessoa Coelho fusca14 at gmail.com
Thu Sep 16 19:25:59 UTC 2021


Hello...

I have the following issue...

Is it possible to use "proxy_intercept_errors on" with @location?

Invalid config:
  location /images/ {
    proxy_intercept_errors on;
    try_files $uri @backend;
  }
  location / {
    try_files $uri @backend;
  }
  location @backend {
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_redirect off;
    proxy_pass http://my_upstream;
  }

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.

Valid config:
  location /images/ {
    proxy_intercept_errors on;

    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_redirect off;
    proxy_pass http://my_upstream_config;
  }
  location / {
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_redirect off;
    proxy_pass http://my_upstream;
  }

Thanks in advance.


More information about the nginx mailing list