proxy_intercept_errors on;error_page 401 402 403 500 501 502 503 504 505 506 507 508 509 510 511 /error_page.html;location /error_page.html { root /usr/local/xxx/assets/errors; allow all; internal; content_by_lua_block { --do something on upstream error response body }}