505 HTTP Version Not Supported
The HTTP status code 505 HTTP Version Not Supported indicates that the server does not support, or refuses to support, the HTTP protocol version that was used in the request message. This status is typically returned when the server is unable to comprehend the HTTP version specified in the request or when the requested protocol version is not feasible for the server to handle.
Examples
Example 1: Client Request with Unsupported HTTP Version
In some legacy or experimental environments, a client might attempt to use a non-standard or unsupported HTTP version. For example, a request using a hypothetical HTTP version 1.3 might be rejected by the server.
GET /index.html HTTP/1.3
Host: www.example.com
In this scenario, the server might respond with a 505 status code:
HTTP/1.1 505 HTTP Version Not Supported
Content-Type: text/html
Content-Length: 123
Connection: close
<html><body><h1>505 HTTP Version Not Supported</h1><p>The server does not support the HTTP version used in the request.</p></body></html>
Example 2: Server Configuration Limiting Supported Versions
Consider a server that is configured to only support HTTP/1.1 and HTTP/2. If a client attempts to use HTTP/0.9, the server will reject the request:
GET /index.html HTTP/0.9
Host: www.example.com
The server’s response will indicate the lack of support for the requested version:
HTTP/1.1 505 HTTP Version Not Supported
Content-Type: text/html
Content-Length: 98
Connection: close
<html><body><h1>505 HTTP Version Not Supported</h1><p>Please upgrade your HTTP version.</p></body></html>
Example 3 Scenario
# Client sends a request example. GET /example HTTP/1.1 Host: www.example.com # Server Response HTTP/1.1 505 505 HTTP Version Not Supported Date: Wed, 09 Oct 2024 23:11:11 GMT Server: ExampleServer/1.0 Content-Type: application/json { "error": "Description of the error for 505" }
Example 4 different Scenario
# Client sends another example request. POST /another-example HTTP/1.1 Host: www.example.com # Server Response HTTP/1.1 505 505 HTTP Version Not Supported Date: Wed, 09 Oct 2024 23:11:11 GMT Server: ExampleServer/1.0 Content-Type: application/json { "error": "Detailed message for 505" }
Summary
HTTP status code 505 is used when the server encounters a request with an unsupported HTTP version. It serves as a notification to the client that the request cannot be processed as it is using a protocol version that the server cannot handle. Ensuring that client applications use widely supported HTTP versions, such as HTTP/1.1 or HTTP/2, can help avoid encountering this error. Additionally, server configurations should be reviewed to ensure compatibility with the necessary HTTP versions for client requests.