Welcome! Log In Create A New Profile

Advanced

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

Posted by Yongtao You via nginx 
Hi,
I was able to get both form-input-nginx-module and nginx-auth-request-module work fine, individually, with nginx-1.9.9. Putting them together, and the HTTP POST request just timeout (I never got any response back). Any one had any experience using both of them in the same location block?
Thanks.Yongtao
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
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.
Thanks.Yongtao

On Thursday, March 9, 2017 8:58 PM, Yongtao You via nginx <[email protected]> wrote:


Hi,
I was able to get both form-input-nginx-module and nginx-auth-request-module work fine, individually, with nginx-1.9.9. Putting them together, and the HTTP POST request just timeout (I never got any response back). Any one had any experience using both of them in the same location block?
Thanks.Yongtao
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Hello!

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
http://nginx.org/
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Thanks!

On Monday, March 13, 2017 9:38 PM, Maxim Dounin <[email protected]> wrote:


Hello!

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
http://nginx.org/


_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Sorry, only registered users may post in this forum.

Click here to login