Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#20 closed defect (invalid)

error_page directive inconsistently applied

Reported by: bits.myopenid.com Owned by: somebody
Priority: minor Milestone:
Component: nginx-core Version: 1.0.x
Keywords: error_page Cc:
uname -a: Linux sub.domain.tld 2.6.24-29-server #1 SMP Wed Aug 10 17:10:21 UTC 2011 i686 GNU/Linux
nginx -V: nginx: nginx version: nginx/1.0.6
nginx: built by gcc 4.2.4 (Ubuntu 4.2.4-1ubuntu4)
nginx: TLS SNI support enabled
nginx: configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --pid-path=/var/run/nginx.pid --lock-path=/var/lock/nginx.lock --user=www-data --group=www-data --http-client-body-temp-path=/var/lib/nginx/body --http-proxy-temp-path=/var/lib/nginx/proxy --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --http-scgi-temp-path=/var/lib/nginx/scgi --with-http_stub_status_module --with-http_gzip_static_module --with-http_realip_module --with-http_ssl_module --with-md5-asm --with-md5=/usr/include --with-sha1-asm --with-sha1=/usr/include --with-cc-opt=-O2 --add-module=/home/user/src/headers-more-nginx-module

Description

server {
   server_name sub.domain.tld;
   root /home/user/sub.domain.tld;
   error_page 414 /414_request_uri_too_long.html;
}

Make a request for a very long URI, with over 8K characters:
http://sub.domain.tld//testing_414_request_uri_too_long_testing_414_request_uri_too_long_ ... testing_414_request_uri_too_long

Expect to have contents of /414_request_uri_too_long.html delivered with a 414 HTTP status code.

Instead,

<html>
<head><title>414 Request-URI Too Large</title></head>
<body bgcolor="white">
<center><h1>414 Request-URI Too Large</h1></center>
<hr><center>nginx</center>
</body>
</html>

is returned with a 200 status code.

Change History (5)

comment:1 by bits.myopenid.com, 9 years ago

Incidentally, http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.15 lists the textual representation of the 414 code as "Request-URI Too Long", whereas it seems nginx represents it as "Request-URI Too Large"

comment:2 by bits.myopenid.com, 9 years ago

Correction: I said it's returning that html with a HTTP 200, but it seems it's not returning any HTTP headers at all.

comment:3 by bits.myopenid.com, 9 years ago

The access log receives an entry stating 414, while the error log has pcre_exec() failed: -2 on "" using "" while reading client request line,...

Last edited 9 years ago by bits.myopenid.com (previous) (diff)

comment:4 by Maxim Dounin, 9 years ago

Resolution: invalid
Status: newclosed

It returns HTTP/0.9 reply as it's not possible to parse complete http request once buffer for request exceeded. And error_page is applied, but it must be configured in default server, as (for the same reason) it's not possible to parse "Host:" header in the request and find appropriate name-based virtual server.

comment:5 by bits.myopenid.com, 9 years ago

In this config, there's another server block that has a listen 80 default_server, and has an error_page 414 defined. nginx is not serving that for long requests either.

Note: See TracTickets for help on using tickets.