Opened 11 years ago
Closed 11 years ago
Last modified 11 years ago
#124 closed enhancement (invalid)
ngx_http_subrequest() supports only GET method?
|Reported by:||Alexey Radkov||Owned by:||somebody|
|uname -a:||Linux localhost.localdomain 184.108.40.206-106.fc14.x86_64 #1 SMP Wed Nov 23 13:07:52 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux|
nginx: nginx version: nginx/1.0.10
nginx: configure arguments: --add-module=../contrib/nginx_http_echo_module/ --add-module=../nginx_http_rc_module --with-debug
The question is why? Is this important for nginx healthy work?
I create subrequests in my own module for passing requests to a next upstream in a given list of upstreams until working server in some upstream in the list found (this is kind of failover technique). Original request's methods can be GET or POST. But ngx_http_subrequest() insists on GET only:
sr->method = NGX_HTTP_GET;
sr->method_name = ngx_http_core_get_method;
I changed these lines in ngx_http_subrequest() by:
sr->method = r->method;
sr->method_name = r->method_name;
May i have any problems with that? My tests shows nothing wrong.
Change History (2)
comment:1 by , 11 years ago
|Status:||new → closed|
comment:2 by , 11 years ago
Thank you, Maxim.
You are right. Next time i will ask at forum.
Other modules rely on the method being set to GET, and this change will broke them. If you really need method to be preserved, you may restore it after ngx_http_subrequest() call. Note well that request body may require additional care if used in subrequests.
And, BTW, this is wrong place to ask questions, you may have better luck asking in mailing list(s).