Conflict between form-input-nginx-module and nginx-auth-request-module?

Maxim Dounin mdounin at
Mon Mar 13 13:38:03 UTC 2017


On Sat, Mar 11, 2017 at 05:13:38AM +0000, Yongtao You via nginx wrote:

> 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.
> 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.

The ngx_http_read_client_request_body() function must overwrite 
request handlers, including r->write_event_handler, or an write 
event while reading a request body will result in unexpected 
additional processing.

Proper solution would be to fix the form-input module to restore 
r->write_event_handler to ngx_http_core_run_phases() after the 
request body has been read (and before the module calls 
ngx_http_core_run_phases() again).

Maxim Dounin

More information about the nginx mailing list