<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div><div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;">Hello, </div><div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;"><br></div><div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;">I do not not think nginx has this feature, but we can do it with lua module, at it’s exactly what I did, you can find it here: <a href="https://github.com/whatvn/nginx_redirect_balancer">https://github.com/whatvn/nginx_redirect_balancer</a></div><div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;"><br></div><div><font face="Calibri,sans-serif"><u>I</u></font><u style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;">t works with help of following awesome module by agentzh: </u><span style="color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.6px; widows: 1; background-color: rgb(247, 247, 247);">lua-nginx-module and lua-updstream-module </span></div><div><span style="color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.6px; widows: 1; background-color: rgb(247, 247, 247);"><br></span></div><div><span style="color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.6px; widows: 1; background-color: rgb(247, 247, 247);"><br></span></div><div><span style="color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.6px; widows: 1; background-color: rgb(244, 244, 244);">-</span></div><div><span style="color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.6px; widows: 1; background-color: rgb(241, 241, 241);">Hung</span></div><div><span style="color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.6px; widows: 1; background-color: rgb(241, 241, 241);"><br></span></div><div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;"><div id="MAC_OUTLOOK_SIGNATURE"></div></div></div><div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;"><br></div><span id="OLK_SRC_BODY_SECTION" style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;"><div style="font-family:Calibri; font-size:12pt; text-align:left; color:black; BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BORDER-TOP: #b5c4df 1pt solid; BORDER-RIGHT: medium none; PADDING-TOP: 3pt"><span style="font-weight:bold">From: </span> nginx-devel <<a href="mailto:nginx-devel-bounces@nginx.org">nginx-devel-bounces@nginx.org</a>> on behalf of 洪志道 <<a href="mailto:hongzhidao@gmail.com">hongzhidao@gmail.com</a>><br><span style="font-weight:bold">Reply-To: </span> <<a href="mailto:nginx-devel@nginx.org">nginx-devel@nginx.org</a>><br><span style="font-weight:bold">Date: </span> Wednesday, May 18, 2016 at 12:35 PM<br><span style="font-weight:bold">To: </span> <<a href="mailto:nginx-devel@nginx.org">nginx-devel@nginx.org</a>><br><span style="font-weight:bold">Subject: </span> upstream/302<br></div><div><br></div><div dir="ltr"><span style="font-size:14px">Hi</span><div style="font-size:14px"><br></div><div style="font-size:14px">Is there a way to get selected peer in upstream without sending request to backend server?</div><div style="font-size:14px"><br></div><div style="font-size:14px">upstream backend {</div><div style="font-size:14px"> hash $url consistent;</div><div style="font-size:14px"> server 192.168.1.101;</div><div style="font-size:14px"> server 192.168.1.102; # Assume this is selected</div><div style="font-size:14px"> server 192.168.1.103;</div><div style="font-size:14px">}</div><div style="font-size:14px"><br></div><div style="font-size:14px"><br></div><div style="font-size:14px">location /302 {</div><div style="font-size:14px"> proxy_pass <a href="http://backend/" target="_blank">http://backend</a>;</div><div style="font-size:14px"> # need other config or develop custom module?</div><div style="font-size:14px">}</div><div style="font-size:14px"><br></div><div style="font-size:14px"><br></div><div style="font-size:14px">> curl <a href="http://test.com/302" target="_blank">http://test.com/302</a> -v</div><div style="font-size:14px">...</div><div style="font-size:14px">Location: <a href="http://192.168.1.102/xxx" target="_blank">http://192.168.1.102/xxx</a></div><div style="font-size:14px">...</div><div style="font-size:14px"><br></div><div style="font-size:14px">Just get selected server, and i<span style="color:rgb(51,51,51);font-family:arial;font-size:13px;line-height:20.02px">mmediately</span> return for 302 location.</div><div style="font-size:14px">Is it possible to support the feature, or give me advices, thanks so much.</div></div>
_______________________________________________
nginx-devel mailing list
<a href="mailto:nginx-devel@nginx.org">nginx-devel@nginx.org</a>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx-devel">http://mailman.nginx.org/mailman/listinfo/nginx-devel</a></span></body></html>