curl response says "HTTP version not supported", error 505
Categories:
Troubleshooting 'HTTP version not supported' (Error 505) with cURL

Understand and resolve the 'HTTP version not supported' error (HTTP 505) when using cURL, often caused by protocol mismatches or server configurations.
Encountering an 'HTTP version not supported' error (HTTP 505) when making requests with cURL
can be a frustrating experience. This error indicates that the server you are trying to communicate with does not support, or refuses to support, the HTTP protocol version specified in your request. This article will delve into the common causes of this error and provide practical solutions to help you resolve it.
Understanding HTTP 505: 'HTTP Version Not Supported'
The HTTP 505 status code is a client error response code, meaning the server understands the request method but refuses to fulfill it due to the client's HTTP protocol version not being supported. This can happen for several reasons, including:
- Server Configuration: The server might be configured to only accept specific HTTP versions (e.g., HTTP/1.1 only, or HTTP/2 only) and rejects requests using other versions.
- Outdated cURL or OS: An older version of
cURL
or the underlying operating system might be sending an unsupported HTTP version by default. - Proxy Issues: If you're routing your
cURL
request through a proxy, the proxy itself might be altering the HTTP version or not supporting the versioncURL
is trying to use. - Misconfigured Request: You might be explicitly requesting an HTTP version that the server does not support.
flowchart TD A[cURL Request Sent] --> B{Server Receives Request} B --> C{Check HTTP Version} C -- Version Supported --> D[Process Request] C -- Version NOT Supported --> E["HTTP 505: Version Not Supported"] E --> F[cURL Displays Error]
Flowchart illustrating the server's process when encountering an unsupported HTTP version.
Diagnosing and Resolving the Issue
To effectively troubleshoot the HTTP 505 error, you need to identify which HTTP version cURL
is sending and which versions the target server supports. cURL
provides options to explicitly specify the HTTP version, which is key to resolving this problem.
cURL
client to the latest version first, as newer versions often have better protocol support and bug fixes.1. Step 1: Identify the Current HTTP Version Used by cURL
By default, cURL
attempts to use HTTP/2 if available, otherwise it falls back to HTTP/1.1. You can see the version used in verbose output.
2. Step 2: Explicitly Specify HTTP/1.1
Many servers still primarily support HTTP/1.1. Forcing cURL
to use this version is often the quickest fix.
3. Step 3: Explicitly Specify HTTP/2
If the server is modern and you suspect it prefers HTTP/2, try forcing that version. Note that HTTP/2 often requires HTTPS.
4. Step 4: Try HTTP/1.0 (Less Common)
In rare cases, especially with very old or specialized servers, HTTP/1.0 might be the only supported version.
5. Step 5: Check Server Configuration (If You Have Access)
If you manage the server, review its web server configuration (e.g., Apache, Nginx) to ensure it supports the desired HTTP versions.
Practical cURL Commands for Version Control
Here are the cURL
commands you can use to control the HTTP version in your requests.
curl -v https://example.com
Use the -v
(verbose) flag to see detailed information, including the HTTP version used and server responses.
curl --http1.1 https://example.com
Force cURL to use HTTP/1.1 for the request.
curl --http2 https://example.com
Force cURL to use HTTP/2. Note: This often requires HTTPS. If the server doesn't support HTTP/2, it might fall back or error.
curl --http1.0 http://example.com
Force cURL to use HTTP/1.0. This is rarely needed but can be a last resort for very old systems.
https://
in your URL, as HTTP/2 is almost exclusively used over TLS (HTTPS).By systematically trying different HTTP versions with cURL
, you can usually pinpoint the version that the server expects and resolve the 505 error. Remember to also consider network intermediaries like proxies that might be interfering with the protocol negotiation.