Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#493 closed defect (wontfix)

nginx always sends 100-continue instead of delegating that responsibility to upstream server

Reported by: Hugues Bruant Owned by:
Priority: major Milestone:
Component: nginx-core Version: 1.5.x
Keywords: proxy, 100-continue Cc:
uname -a: Linux aerofs 3.5.0-37-generic #58~precise1-Ubuntu SMP Wed Jul 10 17:48:11 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
nginx -V: nginx version: nginx/1.5.6
TLS SNI support enabled
configure arguments: --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-log-path=/var/log/nginx/access.log --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --with-pcre-jit --with-debug --with-http_addition_module --with-http_dav_module --with-http_geoip_module --with-http_gzip_static_module --with-http_image_filter_module --with-http_realip_module --with-http_stub_status_module --with-http_ssl_module --with-http_sub_module --with-http_xslt_module --with-ipv6 --with-mail --with-mail_ssl_module --add-module=/home/vagrant/package_source/nginx-1.5.6/debian/modules/nginx-auth-pam --add-module=/home/vagrant/package_source/nginx-1.5.6/debian/modules/nginx-dav-ext-module --add-module=/home/vagrant/package_source/nginx-1.5.6/debian/modules/nginx-echo --add-module=/home/vagrant/package_source/nginx-1.5.6/debian/modules/nginx-upstream-fair --add-module=/home/vagrant/package_source/nginx-1.5.6/debian/modules/ngx_http_substitutions_filter_module

Description

What I did:

curl -X PUT http://foo.bar/api/deadbeef -T largefile

with foo.bar pointing to an ubuntu box running nginx 1.5.6 with the following configuration:

location /api {

rewrite /api/(.+) /$1 break;
proxy_pass http://127.0.0.1:8083;
proxy_cache off;
proxy_buffering off;
proxy_cookie_path / /api/;
proxy_http_version 1.1;
proxy_set_header Connection $http_connection;
proxy_ignore_headers X-Accel-Charset X-Accel-Buffering X-Accel-Limit-Rate X-Accel-Redirect X-Accel-Expires Expires Cache-Control Set-Cookie;
proxy_read_timeout 60;
proxy_send_timeout 60;
proxy_set_header Verify $ssl_client_verify;
proxy_set_header Serial $ssl_client_serial;
proxy_set_header DName $ssl_client_s_dn;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

}

What I expected:

  • nginx forwards "Expect" header to upstream server
  • upstream server responds with "100 Continue"
  • nginx forwards "100 Continue" downstream
  • curl proceeds with upload of file data

What happened instead:

  • nginx immediately responds with "100 Continue", before the upstream server has a chance to return a 3xx/4xx, which pretty much renders the use of "Expect: 100-continue" useless
  • nginx forwards the "Expect" header to the upstream server, leading it to make incorrect assumptions about the state of the connection (expect no incoming packets until sending "100 Continue", actually get a flood of data) and to send a second "100 Continue"

Change History (2)

comment:1 by Maxim Dounin, 7 years ago

Resolution: wontfix
Status: newclosed

This how it works - nginx needs to read the request body before it will forward it to upstream servers. Unbuffered upload is expected to appear as an option in the future, see roadmap.

comment:2 by Hugues Bruant, 7 years ago

Good to know that unbuffered upload is on your roadmap. Is there any ETA for it?

Note: See TracTickets for help on using tickets.