<html><head></head><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:12px"><div id="yui_3_16_0_ym19_1_1489458181351_37186"><span>Thanks!</span></div> <div class="qtdSeparateBR"><br><br></div><div class="yahoo_quoted" style="display: block;"> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 12px;"> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px;"> <div dir="ltr"><font size="2" face="Arial"> On Monday, March 13, 2017 9:38 PM, Maxim Dounin <mdounin@mdounin.ru> wrote:<br></font></div> <br><br> <div class="y_msg_container">Hello!<br clear="none"><div class="yqt3493225008" id="yqtfd32314"><br clear="none">On Sat, Mar 11, 2017 at 05:13:38AM +0000, Yongtao You via nginx wrote:<br clear="none"><br clear="none">> To answer my own question, even though I still don't see why it has anything to do with the auth-request module, but the reason requests are timing out is because form-input module called ngx_http_read_client_request_body(), which then set write_event_handler to ngx_http_request_empty_handler to block write events. This seems to block the event from being forwarded to the backend (via proxy_pass). I modified the ngx_http_read_client_request_body() implementation to not override the request's write_event_handler, and everything started working. No more timeouts.<br clear="none">> I don't know enough to understand the ramification of my change, even though it seems to fixed my immediate problem. Any insights will be greatly appreciated.</div><br clear="none"><br clear="none">The ngx_http_read_client_request_body() function must overwrite <br clear="none">request handlers, including r->write_event_handler, or an write <br clear="none">event while reading a request body will result in unexpected <br clear="none">additional processing.<br clear="none"><br clear="none">Proper solution would be to fix the form-input module to restore <br clear="none">r->write_event_handler to ngx_http_core_run_phases() after the <br clear="none">request body has been read (and before the module calls <br clear="none">ngx_http_core_run_phases() again).<br clear="none"><br clear="none">-- <br clear="none">Maxim Dounin<br clear="none"><a shape="rect" href="http://nginx.org/" target="_blank">http://nginx.org/</a><div class="yqt3493225008" id="yqtfd97822"><br clear="none"></div><br><br></div> </div> </div> </div></div></body></html>