access the upstream error page (response) while I have defined error_page location?

36 views
Skip to first unread message

Hadi Abbasi

unread,
Dec 22, 2018, 11:14:20 AM12/22/18
to openresty-en
Hey Guys...

is there any way to access upstream response body which is received through body_flter_by_lua block while the response status code is 5xx and I have defined an error_page location?
just I want to access the upstream error page to show it on some special status codes and also want to show my default error page on some special status codes!

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
 
}
}
I don't know why I can access the upstream error response body when there is no any error_page defined! but when  I define error_page location, body_filter_by_lua can't be run and I have no access to upstream error page!
Reply all
Reply to author
Forward
0 new messages