I’m working on a server that is receiving requests from IoT devices. They perform a HEAD request on boot. Unfortunately, it seems there’s something wrong with the headers.
NGINX access log
[11/Sep/2018:13:41:11 +0000] "HEAD / HTTP/1.1" 408 0 "-" "-" --- "-" "-"
The log format is as follows
log_format custom '[$time_local] "$request" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent" ---'
'"$content_type" "$content_length"';
NGINX error log
2018/09/11 13:40:11 [debug] 31368#31368: *1 accept: SRCIP:33930 fd:32
2018/09/11 13:40:11 [debug] 31368#31368: *1 event timer add: 32: 60000:1536673271229
2018/09/11 13:40:11 [debug] 31368#31368: *1 reusable connection: 1
2018/09/11 13:40:11 [debug] 31368#31368: *1 epoll add event: fd:32 op:1 ev:80002001
2018/09/11 13:40:11 [debug] 31368#31368: *1 post event 000056011DBAA2C0
2018/09/11 13:40:11 [debug] 31368#31368: *1 delete posted event 000056011DBAA2C0
2018/09/11 13:40:11 [debug] 31368#31368: *1 http wait request handler
2018/09/11 13:40:11 [debug] 31368#31368: *1 malloc: 000056011DAAB650:1024
2018/09/11 13:40:11 [debug] 31368#31368: *1 recv: fd:32 71 of 1024
2018/09/11 13:40:11 [debug] 31368#31368: *1 reusable connection: 0
2018/09/11 13:40:11 [debug] 31368#31368: *1 posix_memalign: 000056011DB0DCD0:4096 @16
2018/09/11 13:40:11 [debug] 31368#31368: *1 http process request line
2018/09/11 13:40:11 [debug] 31368#31368: *1 http request line: "HEAD / HTTP/1.1"
2018/09/11 13:40:11 [debug] 31368#31368: *1 http uri: "/"
2018/09/11 13:40:11 [debug] 31368#31368: *1 http args: ""
2018/09/11 13:40:11 [debug] 31368#31368: *1 http exten: ""
2018/09/11 13:40:11 [debug] 31368#31368: *1 posix_memalign: 000056011DB690C0:4096 @16
2018/09/11 13:40:11 [debug] 31368#31368: *1 http process request header line
2018/09/11 13:40:11 [debug] 31368#31368: *1 http header: "Host: MYHOST"
2018/09/11 13:40:11 [debug] 31368#31368: *1 recv: fd:32 -1 of 953
2018/09/11 13:40:11 [debug] 31368#31368: *1 recv() not ready (11: Resource temporarily unavailable)
2018/09/11 13:41:11 [debug] 31368#31368: *1 event timer del: 32: 1536673271229
2018/09/11 13:41:11 [debug] 31368#31368: *1 http process request header line
2018/09/11 13:41:11 [info] 31368#31368: *1 client timed out (110: Connection timed out) while reading client request headers, client: SRCIP, server: MYHOST, request: "HEAD / HTTP/1.1", host: "MYHOST"
2018/09/11 13:41:11 [debug] 31368#31368: *1 http request count:1 blk:0
2018/09/11 13:41:11 [debug] 31368#31368: *1 http close request
2018/09/11 13:41:11 [debug] 31368#31368: *1 http log handler
2018/09/11 13:41:11 [debug] 31368#31368: *1 free: 000056011DB0DCD0, unused: 707
2018/09/11 13:41:11 [debug] 31368#31368: *1 free: 000056011DB690C0, unused: 3104
2018/09/11 13:41:11 [debug] 31368#31368: *1 close http connection: 32
2018/09/11 13:41:11 [debug] 31368#31368: *1 reusable connection: 0
2018/09/11 13:41:11 [debug] 31368#31368: *1 free: 000056011DAAB650
2018/09/11 13:41:11 [debug] 31368#31368: *1 free: 000056011DAFF960, unused: 128
Tcpdump sudo tcpdump -n -S -s 0 -A 'src SRCIP and port 80'
shows
13:55:32.846408 IP SRCIP.39761 > DSTIP.80: Flags [S], seq 1846787, win 2920, options [mss 1460], length 0
E..,....p. *E......h.Q.P........`..h;........
13:55:33.153456 IP SRCIP.39761 > DSTIP.80: Flags [.], ack 3538300854, win 2920, length 0
E..(....p..^E......h.Q.P....../.P..hqK........
13:55:33.314206 IP SRCIP.39761 > DSTIP.80: Flags [P.], seq 1846788:1846859, ack 3538300854, win 2920, length 71: HTTP: HEAD / HTTP/1.1
E..o&...p..CE......h.Q.P....../.P..hg...HEAD / HTTP/1.1
Host: MYHOST
Content-Length:
13:56:33.363048 IP SRCIP.39761 > DSTIP.80: Flags [F.], seq 1846859, ack 3538300855, win 2919, length 0
E..(....p...E......h.Q.P...K../.P..gq.........
I cannot change the firmware in the devices so I’m looking for a workaround on the NGINX side. Please let me know if I can provide more info to help with the answer.
EDIT: I’m not adding the server config because I’ve tried too many and I’m not sure what to paste here.
EDIT 2: tcpdump at first logs
13:55:32.846408 IP SRCIP.39761 > DSTIP.80: Flags [S], seq 1846787, win 2920, options [mss 1460], length 0
E..,....p. *E......h.Q.P........`..h;........
13:55:33.153456 IP SRCIP.39761 > DSTIP.80: Flags [.], ack 3538300854, win 2920, length 0
E..(....p..^E......h.Q.P....../.P..hqK........
13:55:33.314206 IP SRCIP.39761 > DSTIP.80: Flags [P.], seq 1846788:1846859, ack 3538300854, win 2920, length 71: HTTP: HEAD / HTTP/1.1
E..o&...p..CE......h.Q.P....../.P..hg...HEAD / HTTP/1.1
Host: MYHOST
Content-Length:
And then the rest after some time. I assume it’s after NGINX times out.
EDIT 3: I finally understand what’s going on. This has been really confusing because there’s one Apache server in production with which the devices work properly. While trying to switch to NGINX things stopped working.
As I’ve said above, the IoT devices on boot are performing a HEAD request. They expect a response with a Date:
header so that they can parse it.
Currently, the device are working fine with Apache because when a timeout is triggered while waiting for headers from the client, Apache returns a 408 response to the client, including the Date:
header.
This directive can set various timeouts for receiving the request headers and the request body from the client. If the client fails to send headers or body within the configured time, a 408 REQUEST TIME OUT error is sent.
(https://httpd.apache.org/docs/2.4/mod/mod_reqtimeout.html)
On the other hand, NGINX when a when a timeout is triggered while waiting for headers from the client, just closes the connection without returning anything to the client. Even if it logs 408 in the access log.
Defines a timeout for reading client request header. If a client does not transmit the entire header within this time, the request is terminated with the 408 (Request Time-out) error.
(http://nginx.org/en/docs/http/ngx_http_core_module.html#client_header_timeout)
There’s been a discussion on this behaviour already https://trac.nginx.org/nginx/ticket/1005.
In other words, the HEAD request from the IoT devices has always being wrong. It just works with Apache because a 408 response with Date:
is sent back whenever a timeout while waiting for headers is triggered.
As I said above, unfortunately there’s no way for me to change how the devices work. Thus, I need to workaround in NGINX. The only way I found is to change the source and compile myself.
This is what I came up with by copy / pasting from the internet. Unfortunately, I haven’t had time to understand the code and prolly won’t ever. It would be really great if somebody helped me understanding how bad that code is and what’s a better way of writing it.
The version of NGINX is 1.14.0.
diff --git a/src/http/ngx_http_request.c b/src/http/ngx_http_request.c
index 2db7a62..086701b 100644
--- a/src/http/ngx_http_request.c
+++ b/src/http/ngx_http_request.c
@@ -1236,7 +1236,7 @@ ngx_http_process_request_headers(ngx_event_t *rev)
if (rev->timedout) {
ngx_log_error(NGX_LOG_INFO, c->log, NGX_ETIMEDOUT, "client timed out");
c->timedout = 1;
- ngx_http_close_request(r, NGX_HTTP_REQUEST_TIME_OUT);
+ ngx_http_finalize_request(r, ngx_http_special_response_handler(r, NGX_HTTP_REQUEST_TIME_OUT));
return;
}
To validate the code is working I used Telnet:
This is what NGINX normally would do
Request
$ telnet HOST 80
Trying IP...
Connected to HOST.
Escape character is '^]'.
HEAD / HTTP/1.1
Content-Length:
Response
Connection closed by foreign host.
This is what NGINX does with the modified code
Request
$ telnet HOST 80
Trying IP...
Connected to HOST.
Escape character is '^]'.
HEAD / HTTP/1.1
Content-Length:
Response
HTTP/1.1 408 Request Time-out
Server: nginx
Date: Tue, 25 Sep 2018 08:18:41 GMT
Content-Type: text/html
Content-Length: 176
Connection: close
Notice that I could use another header in place of Content-Length:
(e.g. Accept:
and the result would be the same). If you are trying to reproduce just remember to press enter once (and only once) after the empty header (in the example Content-Length:
).
#1005
closed
defect
(fixed)
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | major | Milestone: | |
Component: | documentation | Version: | 1.9.x |
Keywords: | Cc: | ||
uname -a: | Linux ubuntu 4.2.0-30-generic #36-Ubuntu SMP Fri Feb 26 00:58:07 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux | ||
nginx -V: |
nginx version: nginx/1.9.3 (Ubuntu) built with OpenSSL 1.0.2d 9 Jul 2015 TLS SNI support enabled configure arguments: —with-cc-opt=’-g -O2 -fPIE -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2′ —with-ld-opt=’-Wl,-Bsymbolic-functions -fPIE -pie -Wl,-z,relro -Wl,-z,now’ —prefix=/usr/share/nginx —conf-path=/etc/nginx/nginx.conf —http-log-path=/var/log/nginx/access.log —error-log-path=/var/log/nginx/error.log —lock-path=/var/lock/nginx.lock —pid-path=/run/nginx.pid —http-client-body-temp-path=/var/lib/nginx/body —http-fastcgi-temp-path=/var/lib/nginx/fastcgi —http-proxy-temp-path=/var/lib/nginx/proxy —http-scgi-temp-path=/var/lib/nginx/scgi —http-uwsgi-temp-path=/var/lib/nginx/uwsgi —with-debug —with-pcre-jit —with-ipv6 —with-http_ssl_module —with-http_stub_status_module —with-http_realip_module —with-http_auth_request_module —with-http_addition_module —with-http_dav_module —with-http_geoip_module —with-http_gunzip_module —with-http_gzip_static_module —with-http_image_filter_module —with-http_spdy_module —with-http_sub_module —with-http_xslt_module —with-stream —with-stream_ssl_module —with-mail —with-mail_ssl_module —with-threads —add-module=/build/nginx-fcyDbp/nginx-1.9.3/debian/modules/nginx-auth-pam —add-module=/build/nginx-fcyDbp/nginx-1.9.3/debian/modules/nginx-dav-ext-module —add-module=/build/nginx-fcyDbp/nginx-1.9.3/debian/modules/nginx-echo —add-module=/build/nginx-fcyDbp/nginx-1.9.3/debian/modules/nginx-upstream-fair —add-module=/build/nginx-fcyDbp/nginx-1.9.3/debian/modules/ngx_http_substitutions_filter_module |
client_body_timeout [1] docs says «If a client does not transmit anything within this time, the 408 (Request Time-out) error is returned to the client.» but this is not true. What happens is that nginx logs a 408 to the access log, but does not send a 408 to client, instead just ungracefully closing the connection. This dropping behavior causes problems with some clients, for example, the Amazon Elastic Load Balancer AKA ELB.
Here is how to reproduce:
Use the attached nginx.conf file (minimally modified from the default) and restart nginx.
Send 2 healthy POST requests to ensure that the nginx.conf is working:
$ perl -e ‘$|++; $request = qq[POST http://127.0.0.1:80/logpost HTTP/1.1rnhost: 127.0.0.1rnContent-length: 10rnConnection: keep-alivernrn0123456789]; print $request; sleep 5; print $request; sleep 5;’ | nc -v 127.0.0.1 80 2>&1 | perl -MTime::HiRes -lane ‘printf qq[%f %sn], Time::HiRes::time(), $_;’
1466811503.325930 Connection to 127.0.0.1 80 port [tcp/http] succeeded!
1466811503.325998 HTTP/1.1 200 OK
1466811503.326008 Server: nginx/1.9.3 (Ubuntu)
1466811503.326017 Date: Fri, 24 Jun 2016 23:38:23 GMT
1466811503.326023 Content-Type: application/octet-stream
1466811503.326030 Content-Length: 0
1466811503.326035 Connection: keep-alive
1466811503.326041
1466811508.323207 HTTP/1.1 200 OK
1466811508.323417 Server: nginx/1.9.3 (Ubuntu)
1466811508.323446 Date: Fri, 24 Jun 2016 23:38:28 GMT
1466811508.323461 Content-Type: application/octet-stream
1466811508.323474 Content-Length: 0
1466811508.323486 Connection: keep-alive
1466811508.323498
Check that they got logged correctly:
$ sudo tail -n 4 /var/log/nginx/access.log
127.0.0.1 — — [24/Jun/2016:16:38:23 -0700] «POST http://127.0.0.1:80/logpost HTTP/1.1″ 200 0 «-» «-«
0123456789
127.0.0.1 — — [24/Jun/2016:16:38:28 -0700] «POST http://127.0.0.1:80/logpost HTTP/1.1″ 200 0 «-» «-«
0123456789
Now send 2 unhealthy POST requests where the body is incomplete thus triggering the client_body_timeout:
$ perl -e ‘$|++; $request = qq[POST http://127.0.0.1:80/logpost HTTP/1.1rnhost: 127.0.0.1rnContent-length: 10rnConnection: keep-alivernrn0]; print $request; sleep 5; print $request; sleep 5;’ | nc -v 127.0.0.1 80 2>&1 | perl -MTime::HiRes -lane ‘printf qq[%f %sn], Time::HiRes::time(), $_;’
1466811649.281460 Connection to 127.0.0.1 80 port [tcp/http] succeeded!
$
According to the docs then we expect a 408 response, but no 408 response is returned.
However, the access log incorrectly states that a 408 response was made:
$ sudo tail -n 6 /var/log/nginx/access.log
127.0.0.1 — — [24/Jun/2016:16:38:23 -0700] «POST http://127.0.0.1:80/logpost HTTP/1.1″ 200 0 «-» «-«
0123456789
127.0.0.1 — — [24/Jun/2016:16:38:28 -0700] «POST http://127.0.0.1:80/logpost HTTP/1.1″ 200 0 «-» «-«
0123456789
127.0.0.1 — — [24/Jun/2016:16:40:50 -0700] «POST http://127.0.0.1:80/logpost HTTP/1.1″ 408 0 «-» «-«
0
The RFC [2] clearly says that «When a client or server wishes to time-out it SHOULD issue a graceful close on the transport connection.» and further says «A client, server, or proxy MAY close the transport connection at any time.» implying that a graceful close is a «Connection: close» response.
Further it says «Servers SHOULD always respond to at least one request per connection, if at all possible. Servers SHOULD NOT close a connection in the middle of transmitting a response, unless a network or client failure is suspected.»
Therefore, I submit that nginx not responding with a 408 response is a bug. And a bug which should be fixed sooner, because it is known to cause the Amazon ELB to further behave in a buggy way.
[1] http://nginx.org/en/docs/http/ngx_http_core_module.html#client_body_timeout
[2] https://tools.ietf.org/html/rfc2616#section-8.1.4
A customer of mine is trying to upload a file to our remote nginx webserver via a form POST using XHR2 form data (and a cross-domain request with CORS). During mid-upload, the webserver returns a 408 and the ajax error handler halts processing as a result. The files are in the 20-120MB range. The access logs for some of the file uploads are as follows (he has tried on Chrome 31 and IE11):
[24/Dec/2013:16:44:18 -0500] "OPTIONS / HTTP/1.1" 200 0 "http://www.example.com/files/upload" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36"
[24/Dec/2013:16:47:50 -0500] "POST / HTTP/1.1" 408 0 "http://www.example.com/files/upload" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36"
...
[27/Dec/2013:01:23:51 -0500] "OPTIONS / HTTP/1.1" 200 0 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko"
[27/Dec/2013:01:33:11 -0500] "POST / HTTP/1.1" 408 0 "http://www.example.com/files/upload" "Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko"
Sometimes files will upload perfectly fine for him with Chrome instead of IE, and sometimes vice versa, but most of the time neither browser will work for him.
I’ve been reading the nginx wiki and the only two settings that correlate with 408 errors are client_body_timeout
and client_header_timeout
. I’m having a hard time understanding the meaning of these two directives. I increased both to 180 seconds but the issue persists. I asked him if he had a slow connection, and he said that he has 2.5 mbps up, which should be fast enough to fully receive the request header (but again, we are unsure of what these 2 directives mean according to the wiki, such as what a «readstep» is). We have successfully received 1GB uploads to our server before from other customers, which usually take around an hour to finish.
For the problematic files that we have eventually successfully received from our customer, we tried uploading the same file in various browsers and it worked perfectly.
I have read that using SSL could cause the timeouts, but the server doesn’t have SSL enabled and we are only using http.
Our nginx.conf:
user www-data;
worker_processes auto;
pid /run/nginx.pid;
events {
worker_connections 5000;
# multi_accept on;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay off;
keepalive_timeout 25;
# Increase client/head body_timeout to prevent 408's for slow Internet connections??
client_header_timeout 180;
client_body_timeout 180;
types_hash_max_size 2048;
server_tokens off;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
##
# Gzip Settings
##
gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_comp_level 5;
gzip_min_length 256;
gzip_types
application/atom+xml
text/javascript
application/javascript
application/json
application/rss+xml
application/vnd.ms-fontobject
application/x-font-ttf
application/x-web-app-manifest+json
application/xhtml+xml
application/xml
font/opentype
image/svg+xml
image/x-icon
text/css
text/plain
text/x-component;
# Increase FastCGI buffers
fastcgi_read_timeout 1500;
fastcgi_buffers 8 16K;
fastcgi_buffer_size 32K;
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
Our upload server config:
server {
listen 80;
server_name upload.example.com;
root /var/www/releases/latest/_UPLOAD/public;
# remove trailing slash, that throws ZF router
if (!-d $request_filename) {
rewrite ^/(.*)/$ /$1 permanent;
}
# 1.2G upload limit + 10M for post data (which is extremely liberal)
client_max_body_size 1210M;
client_body_buffer_size 4M;
proxy_max_temp_file_size 0;
location = /favicon.ico {
access_log off;
log_not_found off;
}
location = /apple-touch-icon.png {
access_log off;
log_not_found off;
}
location / {
# This is for AJAX file uploads... need to set CORS headers
if ($request_method = OPTIONS ) {
add_header Access-Control-Allow-Origin '$scheme://www.example.com';
add_header Access-Control-Allow-Methods 'POST, OPTIONS';
add_header Access-Control-Allow-Headers 'X-Requested-With, Content-Type, Content-Range, Content-Disposition';
return 200;
}
try_files $uri $uri/ /index.php?$args;
index index.php index.html index.htm;
}
location ~ .php$ {
try_files $uri $uri/ /index.php?$args;
index index.php index.html index.htm;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/releases/latest/_UPLOAD/public$fastcgi_script_name;
fastcgi_param APPLICATION_ENV production;
fastcgi_param PATH /usr/bin:/bin:/usr/sbin:/sbin;
fastcgi_intercept_errors on;
include fastcgi_params;
}
error_page 403 =404 /404.html;
error_page 404 /404.html;
location = /404.html {
root /var/www/releases/latest/_UPLOAD/public;
internal;
}
error_page 500 502 503 504 = /50x.html;
location = /50x.html {
root /var/www/releases/latest/_UPLOAD/public;
internal;
}
}
Is there anything in the config that might impede successful uploads and be causing these pesky 408 errors? Nothing is mentioned in the error logs about this issue.
NOTE: We have only used reload
when we make changes to the nginx configuration. We are trying to avoid a restart
but if that is required for our configuration changes to take full effect then we will do it.
I’m sorry, but this is going to be one of those long rants of mine.
The problem with 408
This is (sadly) a typical scenario: A client, or other luser of the interwebs, notices that a website shows HTTP error 408 instead of their favorite content. Oh no! “the remote server returned an error: (408) request timeout!” He or she then asks the web developer to make the bad error go away.
The “seasoned” web developer looks at the error logs, and notices an error: something to do with timeouts. Having no idea what it means, he or she googles the error, and voila! an article gives “the” solution for this type of error. It looks something like this:
Locate your nginx config file, or your
php.ini
file, and increasemax_execution_time
(or some variation thereof).— some random “technical” article on the web
Usually the article will also include some helpful info on how to locate these files, and how to restart the server after you’re done editing them (as if you shouldn’t know this already).
Let’s think for a moment about what has happened here
Web servers (usually Apache, Nginx, etc) are configured by default to wait for the back-end (usually PHP) for about 15 or 30 seconds. If the script doesn’t respond in that time, the web server kills the script and sends the user on their merry way with an HTTP status code of 408.
When you increase that timeout limit, what you tell the server is that you’re OK with HTTP requests taking more than 30 seconds. Really? Are you really OK with this?
Do this right now: Count slowly from 1 to 30, to get a feel of what half a minute is like. Would you wait that long for a website to load? Unless you’re working for a government website, I’m guessing you probably care about SEO at least a tiny bit.
So please, next time you see a web script timing out, don’t just blindly increase timeout limits. Dig a little deeper in your log files, do some tests, debug a little. Does the issue occur with all scripts or just with some? What do the PHP-FPM logs say? Are the worker threads up and running? What’s the memory situation like on your server? Maybe add a few debug prints in your script, or do some profiling?
If you’re on a CMS like WordPress, try disabling some plugins. Switch to another theme. Tinker with your caches. Try to isolate the component that causes the issue.
Conclusion
I don’t know what’s wrong with your server. But I know it shouldn’t be taking over half a minute to respond to an HTTP request. So please, do your job as an engineer, and look for the root cause of the issue.
Same goes for maximum memory, worker threads count etc. Don’t just increase numbers at random. Look at your traffic first. What amount of worker threads do you need? What do your scripts need in terms of resources? You know that these things use CPU and memory, right?
The HTTP Status Code starting with series digit 4xx are the client side error codes. The 408 Request Timeout Error code is one of the client-side code that occurs when the request time to load a webpage exceeds.
It is also possible that the server could be the cause of a 408 Request Timeout Error. In some cases, there is a chance that the server may be misconfigured and results in improper requests handling which in return may lead to 408 response code.
What Does 408 Request Timeout Mean?
The 408 Request Timeout Error code occurs when a connection with the website is timed out. It means the request you made to the web server is taking too much time as compared to the waiting time of the website’s server.
Client requests load time is much higher than the server’s waiting time for a particular request. In short, Request Time > Server Waiting Time.
In this case, the server will terminate the connection and thus return in 408 Request Timeout Error.
Symptoms of HTTP Error 408
1. It crashes the active window.
2. Request Timeout is displayed.
3. Windows runs sluggishly and responds slowly to input devices.
Different ways to See a 408 Request Timeout Error
You can see the 408 Request Timeout error in many different ways. Although the textual presentation is slightly different otherwise, each one has the same meaning.
1. “408 Request Time-out”
2. “Request Timeout”
3. “The Request Has Timed Out”
4. “408: Request Timeout”
5. “HTTP Error 408 – Request Timeout”
How Is a 408 Error Different From a 504 Error?
If you are a website owner, then there are 99% of the possibilities that you have encountered during the 504 Gateway Timeout error. You may also be wondering that how a 408 Request Timeout Error is different from the 504 Gateway Timeout error.
The HTTP status code 504 Gateway Timeout error is returned when a server is acting as a gateway or proxy and has timed out. While the 408 Error, returned as a direct message from the active server.
The 408 Request Timeout:
This error occurs when the server request wait time is lower than the server request time.
While the 504 Gateway Timeout:
This error occurs when one server is not able to receive a timely response from another server that may be acting as gateway or proxy.
Start With a Backup
Prevention is better than cure. It is better to walk on the safer side than not regret later.
It is recommended to take a full backup of your website, database and all other components before attempting any fixes. You can use Backup Bank to take a complete backup of your website and database. You can find it easily on wordpress.org plugins directory.
Different Methods to Fix a 408 Request Timeout Error
It is very difficult to detect the source of the HTTP error. Although the 4xx series error is known to be the client-side errors. But it doesn’t mean that the server is completely ruled out as the culprit.
Method 1) Client Side fixes
Below are a few things you can check on the client side in order to fix the 408 Request Timeout Error.
1. Double Check the URL
Sometimes, the cause behind the error is the URL you are requesting.
Now, suppose that you are requesting a URL that requires certain credentials to access and depending on how the server is configured, this could trigger a 408 response from the server. Or you are requesting a website URL from the saved bookmark that not exists.
2. Check your Internet Connection
Try to check your internet connection. If it is slow, then this could take too long to complete the request. As a result, the server timeout value exceeded and it becomes idle. This will returns 408 HTTP Status Code.
3. Try Reloading the Page
This is the easiest way to get rid of the error. Sometimes, there is a temporary problem on the client side or even the server side. Try to refresh the page that you are trying to access to see if the error has been resolved or not.
4. Rollback Recent Upgrades
If you have recently updated the WordPress just before the 408 Request Timeout appeared, you may need to rollback to the previous version.
Similarly, any extension, any modules or even any plugin or theme that you may have recently upgraded can also cause server-side issues, so retrieving to the previous version of those may also help.
Method 2) Server Side Fixes
Below are a few things you can check, on the server side in order to fix the 408 Request Timeout Error.
1. Check your Web Server’s Timeout Settings
It is possible that your web server’s timeout value is less than that of the client request time. Apache, Nginx is the web servers that allows web developers to set some timeout values so that the request is not open for a long time.
Moreover, if you are receiving a continuous 408 request timeout error then, this might be the small timeout value.
If we talk about the Apache Server, check for the .htaccess file as well as the Apache server config file. Look for: KeepAliveTimeout or RequestReadTimeout directives
In the case of the Nginx Server, Open the nginx.conf file and check for directives such as client_body_timeout, client_header_timeout or keepalive_timeout
If either of these directives is defined, try increasing their values, reload the web server and try again.
2. Check the Logs
It is always good to check the server’s error logs. This may provide you with information in order to help you resolve the issue ( like what is the nature of the error? or from where it is originated ).
Conclusion
WordPress Plugins
-
Backup Bank -
Captcha Bank -
Captcha Booster -
Clean Up Booster -
Clean Up Optimizer -
Coming Soon Booster -
Contact Bank -
Facebook Like Box -
Gallery Bank -
Gallery Master -
Google Maps Bank -
Limit Attempts Booster -
WP Mail Bank -
WP Mail Booster