Forum: NGINX Changing Nginx keep-alive behavior based on error response of proxied server

2974d09ac2541e892966b762aad84943?d=identicon&s=25 nginxCoder (Guest)
on 2013-08-06 21:25
(Received via mailing list)
I was wondering if there is a way in Nginx to force a client to close
the
connection (or modify the keepalive parameters) when a proxied server
returns a particular error response. To elaborate a bit, if I have Nginx
as
a proxy in front of a backend server, can Nginx be made to change its
keep
alive behavior based on the error response of the back end server? For
example, if I have keepalive_requests as, say 30, in my Nginx config but
if
the proxied server returns some 4xx or 5xx error, I'd like to send a
connection close to the client or perhaps make keepalive_requests as 0
for
that connection, forcing the client to open up a new connection.

One approach I tried was to intercept the error (proxy_intercept_errors
on)
and used the error page directive to refer to a location wherein I set
the
keepalive_requests as 0. This seems to make the client close the current
connection but there doesn't seem to be a way to return the actual
response
from the backend server when using proxy_intercept_errors. It would be
nice
to be able to return the actual error response from the backend server
than
just return some static content.
Please let me know if  anyone has any suggestions or ideas.
Thanks.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,241653,241653#msg-241653
2974d09ac2541e892966b762aad84943?d=identicon&s=25 nginxCoder (Guest)
on 2013-08-09 05:36
(Received via mailing list)
Any ideas/suggestions related to forcing a client connection close on
certain errors from proxied server? Please refer my previous post for
details.
Thanks.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,241653,241721#msg-241721
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.