Opened 5 years ago

Closed 5 years ago

#1985 closed defect (duplicate)

No header response in 400 Bad Request

Reported by: Seena Fallah Owned by:
Priority: major Milestone: unit-1.18
Component: nginx-core Version: 1.16.x
Keywords: Cc:
uname -a: Linux 4.15.0-76-generic #86-Ubuntu SMP Fri Jan 17 17:24:28 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
nginx -V: nginx version: nginx/1.16.1
built by gcc 7.4.0 (Ubuntu 7.4.0-1ubuntu1~18.04.1)
built with OpenSSL 1.1.1 11 Sep 2018
TLS SNI support enabled
configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-compat --with-file-aio --with-threads --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-cc-opt='-g -O2 -fdebug-prefix-map=/data/builder/debuild/nginx-1.16.1/debian/debuild-base/nginx-1.16.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fPIC' --with-ld-opt='-Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -pie'

Description

When sending bad requests like

OPTIONS / RTSP/1.0

Nginx will response 400 Bad Request without any response headers.
I think this should be done with response headers because some load balancers like haproxy detect these responses as an invalid response!

Change History (1)

comment:1 by Maxim Dounin, 5 years ago

Resolution: duplicate
Status: newclosed

As already explained in http://mailman.nginx.org/pipermail/nginx-devel/2020-March/013051.html, this non-HTTP request is interpreted as HTTP/0.9 request, and nginx responds accordingly. That is, the observed behaviour is not a bug. If a load balancer you use is not happy with the response, you may want to configure it to avoid passing non-HTTP requests to nginx, or fix it be prepared to non-HTTP-1.x responses.

This, however, might be an additional reason to stop accepting non-escaped spaces as discussed in ticket #196. Closing this as a duplicate of #196.

Note: See TracTickets for help on using tickets.