Opened 2 years ago
Closed 2 years ago
#2420 closed defect (duplicate)
error_page directive has no effect on 408
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | minor | Milestone: | |
Component: | nginx-core | Version: | 1.23.x |
Keywords: | 408 error_page | Cc: | quentin.wentzler.klaxit.com@… |
uname -a: | Darwin macbook-pro-2022-de-quentin.home 21.4.0 Darwin Kernel Version 21.4.0: Fri Mar 18 00:47:26 PDT 2022; root:xnu-8020.101.4~15/RELEASE_ARM64_T8101 arm6 | ||
nginx -V: |
nginx version: nginx/1.23.1
built by clang 13.1.6 (clang-1316.0.21.2.5) built with OpenSSL 1.1.1q 5 Jul 2022 TLS SNI support enabled configure arguments: --prefix=/opt/homebrew/Cellar/nginx/1.23.1 --sbin-path=/opt/homebrew/Cellar/nginx/1.23.1/bin/nginx --with-cc-opt='-I/opt/homebrew/opt/pcre2/include -I/opt/homebrew/opt/openssl@1.1/include' --with-ld-opt='-L/opt/homebrew/opt/pcre2/lib -L/opt/homebrew/opt/openssl@1.1/lib' --conf-path=/opt/homebrew/etc/nginx/nginx.conf --pid-path=/opt/homebrew/var/run/nginx.pid --lock-path=/opt/homebrew/var/run/nginx.lock --http-client-body-temp-path=/opt/homebrew/var/run/nginx/client_body_temp --http-proxy-temp-path=/opt/homebrew/var/run/nginx/proxy_temp --http-fastcgi-temp-path=/opt/homebrew/var/run/nginx/fastcgi_temp --http-uwsgi-temp-path=/opt/homebrew/var/run/nginx/uwsgi_temp --http-scgi-temp-path=/opt/homebrew/var/run/nginx/scgi_temp --http-log-path=/opt/homebrew/var/log/nginx/access.log --error-log-path=/opt/homebrew/var/log/nginx/error.log --with-compat --with-debug --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_degradation_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-ipv6 --with-mail --with-mail_ssl_module --with-pcre --with-pcre-jit --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module |
Description
error_page does not override 408 status code.
With the following server configuration:
server { listen 8080; server_name localhost; error_page 400 408 = @convert; location @convert { return 200; } location = /test_400 { return 400; } location = /test_408 { return 408; } }
A curl on test_400 reply with a 200:
curl localhost:8080/test_400 -v * Trying 127.0.0.1:8080... * Connected to localhost (127.0.0.1) port 8080 (#0) > GET /test_400 HTTP/1.1 > Host: localhost:8080 > User-Agent: curl/7.79.1 > Accept: */* > * Mark bundle as not supporting multiuse < HTTP/1.1 200 OK < Server: nginx/1.23.1 < Date: Tue, 29 Nov 2022 14:24:00 GMT < Content-Type: application/octet-stream < Content-Length: 0 < Connection: close < * Closing connection 0
But on test_408 the 408 is not caught and the connection is closed without response:
curl localhost:8080/test_408 -v * Trying 127.0.0.1:8080... * Connected to localhost (127.0.0.1) port 8080 (#0) > GET /test_408 HTTP/1.1 > Host: localhost:8080 > User-Agent: curl/7.79.1 > Accept: */* > * Empty reply from server * Closing connection 0 curl: (52) Empty reply from server
The documentation does not indicate any special behaviour for this specific status code
Is this a bug or an issue in the documentation?
Note:
See TracTickets
for help on using tickets.
The 408 error is never returned to the client. Instead, nginx simply terminates processing of the request with the error, and closes the connection. This is documented in the client_header_timeout and client_body_timeout directives, see ticket #1005.