Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#332 closed defect (wontfix)

request method in subrequest not honored by uwsgi module

Reported by: amotl.myopenid.com Owned by:
Priority: critical Milestone:
Component: nginx-module Version: 1.2.x
Keywords: uwsgi Cc:
uname -a: Linux almera 2.6.32-5-xen-amd64 #1 SMP Fri Feb 15 18:45:30 UTC 2013 x86_64 GNU/Linux
nginx -V: nginx version: ngx_openresty/1.2.6.6 built by gcc 4.4.5 (Debian 4.4.5-8) TLS SNI support enabled configure arguments: --prefix=/home/amo/tmp/openresty-uwsgi-buildout/parts/openresty/nginx --with-cc-opt='-D NGX_HAVE_CASELESS_FILESYSTEM=0' --add-module=../ngx_devel_kit-0.2.18 --add-module=../echo-nginx-module-0.42 --add-module=../ngx_coolkit-0.2rc1 --add-module=../set-misc-nginx-module-0.22rc8 --add-module=../srcache-nginx-module-0.19 --add-module=../ngx_lua-0.7.15 --add-module=../headers-more-nginx-module-0.19 --with-ld-opt=-Wl,-rpath,/home/amo/tmp/openresty-uwsgi-buildout/parts/openresty/luajit/lib --with-http_stub_status_module --with-http_ssl_module --with-http_realip_module --without-mail_pop3_module --without-mail_imap_module --without-mail_smtp_module --without-http_geo_module --without-http_memcached_module --without-http_empty_gif_module --without-http_fastcgi_module --without-http_scgi_module --without-http_upstream_keepalive_module

Description

Hey there,

while switching our Python WSGI Pyramid application stack
to uWSGI behind Nginx/OpenResty we hit a road block when issuing
subrequests from Lua to the uWSGI application.

The code in ngx_http_uwsgi_module.c does not seem to honor
the request method when being in the context of a subrequest.
Instead, it seems to inherit the request method of the origin
request.

We're using OpenResty 1.2.6.6 (Nginx 1.2.6), however switching
to OpenResty 1.2.7.5 (Nginx 1.2.7) makes no difference.

We already filed this issue at the uWSGI project:
https://github.com/unbit/uwsgi/issues/222

Additionally, we prepared a wash & go buildout environment and a summary to reproduce this issue:

Thanks for looking into this!

Cheers,
Andreas.

Change History (2)

comment:1 Changed 6 years ago by mdounin

  • Resolution set to wontfix
  • Status changed from new to closed

The default uwsgi_params file uses $request_method variable to pass request method to backends. This results in the request method of the original request, as per the following change in nginx 0.3.45:

    *) Change: the $request_method variable now returns the main request
       method.

The change in question was likely made to make it possible to properly check $request_method of the main request in SSI includes, which are the original purpose of subrequests.

For uwscgi (scgi, fastcgi) this results in main request method being used in upstream requests by default, and this is believed to be the right thing in most cases. If you are not happy with this behaviour, you may use custom fastcgi_param to pass any REQUEST_METHOD you want to upstream servers.

comment:2 Changed 6 years ago by amotl.myopenid.com

Now having

include      ${openresty:location}/nginx/conf/uwsgi_params;
uwsgi_param  REQUEST_METHOD     $echo_request_method;

solves it perfectly for us.

Thanks a lot!

Note: See TracTickets for help on using tickets.