301b Exam QuestionsBrowse all questions from this exam

301b Exam - Question 82


A web developer has created a custom HTTP call to a backend application. The HTTP headers being sent by the HTTP call are:

GET / HTTP/1.1 -

User-Agent: MyCustomApp (v1.0)

Accept: text/html -

Cache-Control: no-cache -

Connection: keep-alive -

CookiE. somecookie=1 -

The backend server is responding with the following:

HTTP/1.1 400 Bad Request -

DatE. Wed, 20 Jul 2012 17:22:41 GMT

Connection: close -

Why is the HTTP web server responding with a HTTP 400 Bad Request?

Show Answer
Correct Answer: A

The client request does NOT include a Host header. In HTTP/1.1, the Host header is mandatory and specifies the domain name of the server and optionally the TCP port number on which the server is listening. If the Host header is missing, the server does not know which resource to serve, resulting in a 400 Bad Request error.

Discussion

1 comment
Sign in to comment
GVKDOption: A
Feb 11, 2024

A - Correct The Host header is mandatory in HTTP/1.1 requests and specifies the intended server and optional port number. Its absence leaves the server unsure of which resource to serve and triggers the error.