Return 408 does not return body and status = 200

Hello!

If i set

return 408;

there is no return status 408 and no body response.

Posted at Nginx Forum:

2011/02/08 15:05:11 [debug] 25004#0: *3 event timer del: 56:
1297173971541
2011/02/08 15:05:11 [debug] 25004#0: *3 rewrite phase: 0
2011/02/08 15:05:11 [debug] 25004#0: *3 test location: "/"
2011/02/08 15:05:11 [debug] 25004#0: *3 test location: "expired.html"
2011/02/08 15:05:11 [debug] 25004#0: *3 test location: "bad_hash.html"
2011/02/08 15:05:11 [debug] 25004#0: *3 using configuration "/"
2011/02/08 15:05:11 [debug] 25004#0: *3 http cl:-1 max:1048576
2011/02/08 15:05:11 [debug] 25004#0: *3 rewrite phase: 2
2011/02/08 15:05:11 [debug] 25004#0: *3 http script var
2011/02/08 15:05:11 [debug] 25004#0: *3 expired timestamp
2011/02/08 15:05:11 [debug] 25004#0: *3 http script var: "-1"
2011/02/08 15:05:11 [debug] 25004#0: *3 http script value: "-1"
2011/02/08 15:05:11 [debug] 25004#0: *3 http script equal
2011/02/08 15:05:11 [debug] 25004#0: *3 http script if
2011/02/08 15:05:11 [debug] 25004#0: *3 http finalize request: 408,
"/A_134_2.zip/fa90d996636b0a27eced337b08cec6c8/4d505737?" a:1, c:1
2011/02/08 15:05:11 [debug] 25004#0: *3 http terminate request count:1
2011/02/08 15:05:11 [debug] 25004#0: *3 http terminate cleanup count:1
blk:0
2011/02/08 15:05:11 [debug] 25004#0: *3 http posted request:
"/A_134_2.zip/fa90d996636b0a27eced337b08cec6c8/4d505737?"
2011/02/08 15:05:11 [debug] 25004#0: *3 http terminate handler count:1
2011/02/08 15:05:11 [debug] 25004#0: *3 http request count:1 blk:0
2011/02/08 15:05:11 [debug] 25004#0: *3 http close request
2011/02/08 15:05:11 [debug] 25004#0: *3 http log handler
2011/02/08 15:05:11 [debug] 25004#0: *3 free: 00000000006D2730, unused:
726
2011/02/08 15:05:11 [debug] 25004#0: *3 close http connection: 56
2011/02/08 15:05:11 [debug] 25004#0: *3 free: 000000000074CAC0
2011/02/08 15:05:11 [debug] 25004#0: *3 free: 000000000074C5B0
2011/02/08 15:05:11 [debug] 25004#0: *3 free: 00000000007D09C0, unused:
8
2011/02/08 15:05:11 [debug] 25004#0: *3 free: 00000000007D0450, unused:
128
2011/02/08 15:05:11 [debug] 25004#0: *4 event timer del: 56:
1297173971825
2011/02/08 15:05:11 [debug] 25004#0: *4 rewrite phase: 0
2011/02/08 15:05:11 [debug] 25004#0: *4 test location: "/"
2011/02/08 15:05:11 [debug] 25004#0: *4 test location: "expired.html"
2011/02/08 15:05:11 [debug] 25004#0: *4 test location: "bad_hash.html"
2011/02/08 15:05:11 [debug] 25004#0: *4 using configuration "/"
2011/02/08 15:05:11 [debug] 25004#0: *4 http cl:-1 max:1048576
2011/02/08 15:05:11 [debug] 25004#0: *4 rewrite phase: 2
2011/02/08 15:05:11 [debug] 25004#0: *4 http script var
2011/02/08 15:05:11 [debug] 25004#0: *4 expired timestamp
2011/02/08 15:05:11 [debug] 25004#0: *4 http script var: "-1"
2011/02/08 15:05:11 [debug] 25004#0: *4 http script value: "-1"
2011/02/08 15:05:11 [debug] 25004#0: *4 http script equal
2011/02/08 15:05:11 [debug] 25004#0: *4 http script if
2011/02/08 15:05:11 [debug] 25004#0: *4 http finalize request: 408,
"/A_134_2.zip/fa90d996636b0a27eced337b08cec6c8/4d505737?" a:1, c:1
2011/02/08 15:05:11 [debug] 25004#0: *4 http terminate request count:1
2011/02/08 15:05:11 [debug] 25004#0: *4 http terminate cleanup count:1
blk:0
2011/02/08 15:05:11 [debug] 25004#0: *4 http posted request:
"/A_134_2.zip/fa90d996636b0a27eced337b08cec6c8/4d505737?"
2011/02/08 15:05:11 [debug] 25004#0: *4 http terminate handler count:1
2011/02/08 15:05:11 [debug] 25004#0: *4 http request count:1 blk:0
2011/02/08 15:05:11 [debug] 25004#0: *4 http close request
2011/02/08 15:05:11 [debug] 25004#0: *4 http log handler
2011/02/08 15:05:11 [debug] 25004#0: *4 free: 00000000006D2730, unused:
726
2011/02/08 15:05:11 [debug] 25004#0: *4 close http connection: 56
2011/02/08 15:05:11 [debug] 25004#0: *4 free: 000000000074CAC0
2011/02/08 15:05:11 [debug] 25004#0: *4 free: 000000000074C5B0
2011/02/08 15:05:11 [debug] 25004#0: *4 free: 00000000007D09C0, unused:
8
2011/02/08 15:05:11 [debug] 25004#0: *4 free: 00000000007D0450, unused:
128
2011/02/08 15:38:22 [debug] 25004#0: *658 event timer del: 60:
1297175962966

Posted at Nginx Forum:

2011/02/08 15:41:24 [debug] 25270#0: *3 event timer del: 56:
1297176144249
2011/02/08 15:41:24 [debug] 25270#0: *3 rewrite phase: 0
2011/02/08 15:41:24 [debug] 25270#0: *3 test location: "/"
2011/02/08 15:41:24 [debug] 25270#0: *3 test location: "expired.html"
2011/02/08 15:41:24 [debug] 25270#0: *3 using configuration
"/expired.html"
2011/02/08 15:41:24 [debug] 25270#0: *3 http cl:-1 max:1048576
2011/02/08 15:41:24 [debug] 25270#0: *3 rewrite phase: 2
2011/02/08 15:41:24 [debug] 25270#0: *3 http finalize request: 408,
"/expired.html?" a:1, c:1
2011/02/08 15:41:24 [debug] 25270#0: *3 http terminate request count:1
2011/02/08 15:41:24 [debug] 25270#0: *3 http terminate cleanup count:1
blk:0
2011/02/08 15:41:24 [debug] 25270#0: *3 http posted request:
"/expired.html?"
2011/02/08 15:41:24 [debug] 25270#0: *3 http terminate handler count:1
2011/02/08 15:41:24 [debug] 25270#0: *3 http request count:1 blk:0
2011/02/08 15:41:24 [debug] 25270#0: *3 http close request
2011/02/08 15:41:24 [debug] 25270#0: *3 http log handler
2011/02/08 15:41:24 [debug] 25270#0: *3 free: 00000000006D2730, unused:
728
2011/02/08 15:41:24 [debug] 25270#0: *3 close http connection: 56
2011/02/08 15:41:24 [debug] 25270#0: *3 free: 000000000074CAC0
2011/02/08 15:41:24 [debug] 25270#0: *3 free: 000000000074C5B0
2011/02/08 15:41:24 [debug] 25270#0: *3 free: 00000000007CFF70, unused:
8
2011/02/08 15:41:24 [debug] 25270#0: *3 free: 00000000007D09C0, unused:
128
2011/02/08 15:41:24 [debug] 25270#0: *4 event timer del: 56:
1297176144782
2011/02/08 15:41:24 [debug] 25270#0: *4 rewrite phase: 0
2011/02/08 15:41:24 [debug] 25270#0: *4 test location: "/"
2011/02/08 15:41:24 [debug] 25270#0: *4 test location: "expired.html"
2011/02/08 15:41:24 [debug] 25270#0: *4 using configuration
"/expired.html"
2011/02/08 15:41:24 [debug] 25270#0: *4 http cl:-1 max:1048576
2011/02/08 15:41:24 [debug] 25270#0: *4 rewrite phase: 2
2011/02/08 15:41:24 [debug] 25270#0: *4 http finalize request: 408,
"/expired.html?" a:1, c:1
2011/02/08 15:41:24 [debug] 25270#0: *4 http terminate request count:1
2011/02/08 15:41:24 [debug] 25270#0: *4 http terminate cleanup count:1
blk:0
2011/02/08 15:41:24 [debug] 25270#0: *4 http posted request:
"/expired.html?"
2011/02/08 15:41:24 [debug] 25270#0: *4 http terminate handler count:1
2011/02/08 15:41:24 [debug] 25270#0: *4 http request count:1 blk:0
2011/02/08 15:41:24 [debug] 25270#0: *4 http close request
2011/02/08 15:41:24 [debug] 25270#0: *4 http log handler
2011/02/08 15:41:24 [debug] 25270#0: *4 free: 00000000006D2730, unused:
728
2011/02/08 15:41:24 [debug] 25270#0: *4 close http connection: 56
2011/02/08 15:41:24 [debug] 25270#0: *4 free: 000000000074CAC0
2011/02/08 15:41:24 [debug] 25270#0: *4 free: 000000000074C5B0
2011/02/08 15:41:24 [debug] 25270#0: *4 free: 00000000007CFF70, unused:
8
2011/02/08 15:41:24 [debug] 25270#0: *4 free: 00000000007D09C0, unused:
128

Posted at Nginx Forum:

Hello!

On Tue, Feb 08, 2011 at 09:02:30AM -0500, DeineAgentur wrote:

Hello!

If i set

return 408;

there is no return status 408 and no body response.

Yes, it’s expected. Code 408 is expected to be generated when
client timed out and we aren’t willing to wait anymore, it causes
immediate request (and connection) close.

Maxim D.

Here my config:

location /expired.html {
    return 408;
#    root /var/www/dl_projekt/dl/htdocs;
  }
  location /bad_hash.html {
    root /var/www/dl_projekt/dl/htdocs;
  }


  location / {
  root /var/www/dl_projekt/dl/htdocs;
  secure_download on;
  secure_download_secret DontCopy;
  secure_download_path_mode file;

      if ($secure_download = "-1") {
    return 408;
         #rewrite ^(.*)$ /expired.html break;
  }
  if ($secure_download = "-2") {
    return 401;
         #rewrite ^(.*)$ /bad_hash.html break;
  }
  if ($secure_download = "-3") {
          return 402;
  }
  if ($uri ~ "^/(.*)/[0-9a-zA-Z]*/[0-9a-zA-Z]*$") {
         set $filename $1;
  }
  # Set appropriate headers
       add_header Content-Disposition "attachment; filename=$filename";
  rewrite ^(.*)/[0-9a-zA-Z]*/[0-9a-zA-Z]*$ $1 break;
  }

Posted at Nginx Forum:

Hi Maxim,

sure it is! But if the time between 2 requests for authentication too
large is a 408 code should be thrown.

When this code is issued, it should not be Returned with code 200, but
that happened here.

Otherwise, the client does not understand what’s going on. Sure, we
could also have a code 503, but based on the “edit log” is a code 408 is
required.

Other webservers do response also the code 408 and a body.

Posted at Nginx Forum: