Welcome! Log In Create A New Profile

Advanced

How to get response body when using proxy_intercept_errors

July 14, 2020 04:25AM
I have a requirement where when proxied response error code is 401 (condition #1) and response body has text "SAML Token Expired" (condition #2), I need to intercept it and redirect to refresh token API.

I could do it partially where only error code 401 is considered. Not able to find a way to read response body text to give condition #2:

"location /service {
proxy_intercept_errors on;
error_page 401 = @refresh;
}
location @refresh {

(# Here check if the response body has text "SAML Token Expired". If yes return 401 directly.)

set $original_uri $scheme://$http_host$request_uri;
return 307 https://localhost:8083/service/auth/refresh?uri=$original_uri;
}"

Please help me on getting the response body text. Thanks in advance!
Subject Author Posted

How to get response body when using proxy_intercept_errors

salmanpskply July 14, 2020 04:25AM

Re: How to get response body when using proxy_intercept_errors

Maxim Dounin July 14, 2020 09:14AM

Re: How to get response body when using proxy_intercept_errors

salmanpskply July 14, 2020 09:28AM

Re: How to get response body when using proxy_intercept_errors

Desiree Valdez July 14, 2020 12:14PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 82
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