The HTTP 505 (HTTP Version Not Supported) status code indicates that the server does not support the HTTP protocol version used in the request.
Key Meaning
- The server does not support or refuses to support the HTTP protocol version used in the request.
- Belongs to server-side errors (5xx series).
- Typically a configuration issue rather than a temporary error.
Occurrence Scenarios
- The client used a higher version of the HTTP protocol.
- The server only supports specific HTTP versions.
- Server configuration restricts certain HTTP versions.
Common HTTP Versions:
- HTTP/1.0
- HTTP/1.1
- HTTP/2.0
- HTTP/3.0
Sample response:
HTTP/1.1 505 HTTP Version Not Supported
Content-Type: text/html
Content-Length: 172
<html>
<head>
<title>505 HTTP Version Not Supported</title>
</head>
<body>
<h1>HTTP Version Not Supported</h1>
<p>The server does not support the HTTP protocol version used in the request.</p>
</body>
</html>
Solutions For Server Administrators:
- Update server software.
- Adjust server configuration.
- Enable supported HTTP versions.
- Ensure proper protocol compatibility.
Solutions For Client Developers:
- Use widely supported HTTP versions.
- Implement version downgrade mechanisms.
- Add error handling.
Apache Configuration Example:
<IfModule mod_rewrite.c>
RewriteEngine On
# Restrictions only allow HTTP/1.1 和 HTTP/2
RewriteCond %{THE_REQUEST} !HTTP/1\.1$
RewriteCond %{THE_REQUEST} !HTTP/2\.0$
RewriteRule .* - [F]
</IfModule>
Preventive Measures:
- Regularly update server software.
- Correctly configure supported HTTP versions.
- Implement protocol version detection.
- Provide clear error messages.
- Monitor server logs.
Best Practices:
- Support mainstream HTTP versions.
- Implement graceful version downgrade.
- Provide explicit error notifications.
- Log detailed error information.
- Regularly check server configuration.
This error is often caused by server configuration issues or the client using an incompatible HTTP version, and it needs to be resolved from the perspective of protocol compatibility.