ELB(CLB,ALB,NLB)の種類ごとのHTTPレスポンスの違い

ELB(CLB,ALB,NLB)の種類ごとのHTTPレスポンスの違いについて、以下のHTTPリクエストをベースにいくつかのパターンで挙動を見てみました。

GET / HTTP/1.1
Host: xxxxxxxxx.com

echo test

HTTPリクエストをRFCに準拠しない形で送信時 ## CLB

$ echo test | nc clb.test.hayashier.com 80
HTTP/1.1 503 Service Unavailable.
Content-length:0

ALB

$ echo test | nc alb.test.hayashier.com 80
HTTP/1.1 400 Bad Request
Server: awselb/2.0
Date: Mon, 29 Jan 2018 05:49:34 GMT
Content-Type: text/html
Content-Length: 138
Connection: close

<html>
<head><title>400 Bad Request</title></head>
<body bgcolor=white>
<center><h1>400 Bad Request</h1></center>
</body>
</html>

NLB

$ echo test | nc nlb.test.hayashier.com 80
HTTP/1.1 400 Bad Request
Date: Mon, 29 Jan 2018 05:49:41 GMT
Server: Apache/2.2.34 (Amazon)
Content-Length: 335
Connection: close
Content-Type: text/html; charset=iso-8859-1


<html><head>
<title>400 Bad Request</title>
</head><body>
<h1>Bad Request</h1>
<p>Your browser sent a request that this server could not understand.<br />
</p>
<hr>
<address>Apache/2.2.34 (Amazon) Server at ip-172-31-17-170.us-west-2.compute.internal Port 80</address>
</body></html>

GEET / HTTP/1.1\r\nHost: clb.test.hayashier.com\r\n\r\n

存在しないHTTPメソッド指定時 ## CLB

$ printf GEET / HTTP/1.1\r\nHost: clb.test.hayashier.com\r\n\r\n | nc clb.test.hayashier.com 80
HTTP/1.1 501 Method Not Implemented
Allow: GET,HEAD,POST,OPTIONS
Content-Type: text/html; charset=iso-8859-1
Date: Mon, 29 Jan 2018 06:13:44 GMT
Server: Apache/2.2.34 (Amazon)
Content-Length: 304
Connection: Close


<html><head>
<title>501 Method Not Implemented</title>
</head><body>
<h1>Method Not Implemented</h1>
<p>GEET to /index.html not supported.<br />
</p>
<hr>
<address>Apache/2.2.34 (Amazon) Server at clb.test.hayashier.com Port 80</address>
</body></html>

ALB

$ printf GEET / HTTP/1.1\r\nHost: alb.test.hayashier.com\r\n\r\n | nc alb.test.hayashier.com 80

NLB

$ printf GEET / HTTP/1.1\r\nHost: nlb.test.hayashier.com\r\n\r\n | nc nlb.test.hayashier.com 80
HTTP/1.1 501 Method Not Implemented
Date: Mon, 29 Jan 2018 06:14:16 GMT
Server: Apache/2.2.34 (Amazon)
Allow: GET,HEAD,POST,OPTIONS
Content-Length: 304
Connection: close
Content-Type: text/html; charset=iso-8859-1


<html><head>
<title>501 Method Not Implemented</title>
</head><body>
<h1>Method Not Implemented</h1>
<p>GEET to /index.html not supported.<br />
</p>
<hr>
<address>Apache/2.2.34 (Amazon) Server at nlb.test.hayashier.com Port 80</address>
</body></html>

printf GEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE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EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEET / HTTP/1.1\r\nHost: nlb.test.hayashier.com\r\n\r\n | nc nlb.test.hayashier.com 80
HTTP/1.1 501 Method Not Implemented
Date: Mon, 29 Jan 2018 06:15:53 GMT
Server: Apache/2.2.34 (Amazon)
Allow: GET,HEAD,POST,OPTIONS
Content-Length: 1231
Connection: close
Content-Type: text/html; charset=iso-8859-1


<html><head>
<title>501 Method Not Implemented</title>
</head><body>
<h1>Method Not Implemented</h1>
<p>GEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEET to /index.html not supported.<br />
</p>
<hr>
<address>Apache/2.2.34 (Amazon) Server at nlb.test.hayashier.com Port 80</address>
</body></html>

GET / HTTP/1.2\r\nHost: clb.test.hayashier.com\r\n\r\n

存在しないHTTPバージョン指定時 ## CLB

$ printf GET / HTTP/1.2\r\nHost: clb.test.hayashier.com\r\n\r\n | nc clb.test.hayashier.com 80
HTTP/1.1 200 OK
Accept-Ranges: bytes
Content-Type: text/html; charset=UTF-8
Date: Mon, 29 Jan 2018 06:17:10 GMT
ETag: 60725-2f-563c5202222f8
Last-Modified: Sat, 27 Jan 2018 17:13:02 GMT
Server: Apache/2.2.34 (Amazon)
Content-Length: 47
Connection: Close

<html>
    <body>Hello, world2!</body>
</html>

ALB

$ printf GET / HTTP/1.2\r\nHost: alb.test.hayashier.com\r\n\r\n | nc alb.test.hayashier.com 80

NLB

$ printf GET / HTTP/1.2\r\nHost: nlb.test.hayashier.com\r\n\r\n | nc nlb.test.hayashier.com 80
HTTP/1.1 200 OK
Date: Mon, 29 Jan 2018 06:17:34 GMT
Server: Apache/2.2.34 (Amazon)
Last-Modified: Sat, 27 Jan 2018 15:23:55 GMT
ETag: 606ee-2f-563c399ec5b72
Accept-Ranges: bytes
Content-Length: 47
Connection: close
Content-Type: text/html; charset=UTF-8

<html>
    <body>Hello, world1!</body>
</html>

printf GET / HOGE\r\nHost: clb.test.hayashier.com\r\n\r\n | nc clb.test.hayashier.com 80

存在しないプロトコル指定時 ## CLB

$ printf GET / HOGE\r\nHost: clb.test.hayashier.com\r\n\r\n | nc clb.test.hayashier.com 80
HTTP/1.1 400 BAD_REQUEST
Content-Length: 0
Connection: Close

ALB

$ printf GET / HOGE\r\nHost: alb.test.hayashier.com\r\n\r\n | nc alb.test.hayashier.com 80
HTTP/1.1 400 Bad Request
Server: awselb/2.0
Date: Mon, 29 Jan 2018 06:31:35 GMT
Content-Type: text/html
Content-Length: 138
Connection: close

<html>
<head><title>400 Bad Request</title></head>
<body bgcolor=white>
<center><h1>400 Bad Request</h1></center>
</body>
</html>

NLB

$ printf GET / HOGE\r\nHost: nlb.test.hayashier.com\r\n\r\n | nc nlb.test.hayashier.com 80
HTTP/1.1 400 Bad Request
Date: Mon, 29 Jan 2018 06:31:46 GMT
Server: Apache/2.2.34 (Amazon)
Content-Length: 335
Connection: close
Content-Type: text/html; charset=iso-8859-1


<html><head>
<title>400 Bad Request</title>
</head><body>
<h1>Bad Request</h1>
<p>Your browser sent a request that this server could not understand.<br />
</p>
<hr>
<address>Apache/2.2.34 (Amazon) Server at ip-172-31-17-170.us-west-2.compute.internal Port 80</address>
</body></html>

printf GET / HTTP/1.1\r\n\r\n | nc nlb.test.hayashier.com 80

HTTP/1.1でHostヘッダー未指定時 ## CLB

$ printf GET / HTTP/1.1\r\n\r\n | nc clb.test.hayashier.com 80
HTTP/1.1 400 BAD_REQUEST
Content-Length: 0
Connection: Close

ALB

$ printf GET / HTTP/1.1\r\n\r\n | nc alb.test.hayashier.com 80
HTTP/1.1 400 Bad Request
Server: awselb/2.0
Date: Mon, 29 Jan 2018 12:51:06 GMT
Content-Type: text/html
Content-Length: 138
Connection: close

<html>
<head><title>400 Bad Request</title></head>
<body bgcolor=white>
<center><h1>400 Bad Request</h1></center>
</body>
</html>

NLB

$ printf GET / HTTP/1.1\r\n\r\n | nc nlb.test.hayashier.com 80
HTTP/1.1 400 Bad Request
Date: Mon, 29 Jan 2018 12:51:11 GMT
Server: Apache/2.2.34 (Amazon)
Content-Length: 335
Connection: close
Content-Type: text/html; charset=iso-8859-1


<html><head>
<title>400 Bad Request</title>
</head><body>
<h1>Bad Request</h1>
<p>Your browser sent a request that this server could not understand.<br />
</p>
<hr>
<address>Apache/2.2.34 (Amazon) Server at ip-172-31-17-170.us-west-2.compute.internal Port 80</address>
</body></html>

printf GET / HTTP/1.0\r\n\r\n | nc clb.test.hayashier.com 80

HTTP/1.0でHostヘッダー未指定時 ## CLB

$ printf GET / HTTP/1.0\r\n\r\n | nc clb.test.hayashier.com 80
HTTP/1.1 200 OK
Accept-Ranges: bytes
Content-Type: text/html; charset=UTF-8
Date: Mon, 29 Jan 2018 12:49:35 GMT
ETag: 60725-2f-563c5202222f8
Last-Modified: Sat, 27 Jan 2018 17:13:02 GMT
Server: Apache/2.2.34 (Amazon)
Content-Length: 47
Connection: Close

<html>
    <body>Hello, world2!</body>
</html>

ALB

$ printf GET / HTTP/1.0\r\n\r\n | nc alb.test.hayashier.com 80

NLB

$ printf GET / HTTP/1.0\r\n\r\n | nc nlb.test.hayashier.com 80
HTTP/1.1 200 OK
Date: Mon, 29 Jan 2018 12:50:04 GMT
Server: Apache/2.2.34 (Amazon)
Last-Modified: Sat, 27 Jan 2018 17:13:02 GMT
ETag: 60725-2f-563c5202222f8
Accept-Ranges: bytes
Content-Length: 47
Connection: close
Content-Type: text/html; charset=UTF-8

<html>
    <body>Hello, world2!</body>
</html>

My Twitter & RSS

Leave a Reply

Your email address will not be published. Required fields are marked *