HTTP

505 - HTTP Version Not Supported

Hitting a 505 HTTP Version Not Supported means the server doesn't support the HTTP protocol version you're using—requesting HTTP/2 or HTTP/3 on a server that only supports HTTP/1.1, or using an experimental version the server rejects. This server-side error (5xx) indicates a permanent protocol limitation. Most common when clients force HTTP/2 or HTTP/3 on legacy servers, but also appears when protocol negotiation fails, servers explicitly reject certain versions, or infrastructure doesn't support newer protocols.

#Common Causes

  • Frontend: Client forces HTTP/2 or HTTP/3 on server that doesn't support it. Browser auto-negotiates unsupported version. Fetch API uses unsupported protocol version. Client library defaults to newer HTTP version.
  • Backend: Server only supports HTTP/1.1. HTTP/2 or HTTP/3 not configured. Protocol negotiation fails. Server explicitly rejects certain versions. Legacy server without modern protocol support.
  • Infrastructure: Load balancer doesn't support HTTP/2. Reverse proxy strips HTTP/2 headers. TLS/SSL configuration doesn't support ALPN (Application-Layer Protocol Negotiation). CDN doesn't support requested HTTP version.

Solutions

  1. 1Step 1: Diagnose - Check DevTools Network tab Protocol column—see which HTTP version is used. Review server response headers. Check if client is forcing specific version. Review protocol negotiation logs.
  2. 2Step 2: Diagnose - Server logs show which HTTP version was rejected. Check server configuration for supported protocols. Review TLS/SSL configuration for ALPN. Verify infrastructure protocol support.
  3. 3Step 3: Fix - Client-side: Downgrade to HTTP/1.1 if server doesn't support newer versions. Let browser auto-negotiate protocol. Remove explicit protocol version forcing. Update client libraries.
  4. 4Step 4: Fix - Server-side: Enable HTTP/2 support if needed (requires TLS). Configure protocol negotiation (ALPN). Update server software for modern protocol support. Return 505 with Upgrade header if appropriate.
  5. 5Step 5: Fix - Infrastructure: Configure load balancer for HTTP/2 support. Enable ALPN in TLS configuration. Update reverse proxy for protocol support. Configure CDN for requested HTTP version.

</>Code Examples

Fetch API: Handle HTTP Version Issues
1// Client-side: Handle 505 by falling back to HTTP/1.1
2async function fetchWithVersionFallback(url, options = {}) {
3  try {
4    // Try with default protocol (browser will negotiate)
5    const response = await fetch(url, options);
6    
7    if (response.status === 505) {
8      console.warn('HTTP version not supported, server may only support HTTP/1.1');
9      
10      // Check Upgrade header if present
11      const upgrade = response.headers.get('Upgrade');
12      if (upgrade) {
13        console.log(`Server suggests upgrade to: ${upgrade}`);
14      }
15      
16      // For 505, we can't easily force HTTP/1.1 in browser
17      // The browser handles protocol negotiation automatically
18      // This is more relevant for server-side clients
19      throw new Error('HTTP version not supported by server');
20    }
21    
22    return response;
23  } catch (error) {
24  if (error.message.includes('HTTP version')) {
25      // Log error for debugging
26      console.error('HTTP version negotiation failed');
27    }
28    throw error;
29  }
30}
31
32// Note: Browser Fetch API handles HTTP version negotiation automatically
33// 505 errors are rare in browsers but can occur with custom clients
Node.js: Force HTTP/1.1 for Compatibility
1// Server-side client: Force HTTP/1.1 if server doesn't support HTTP/2
2const https = require('https');
3const http = require('http');
4
5async function fetchWithHTTPVersion(url, options = {}) {
6  const urlObj = new URL(url);
7  const isHttps = urlObj.protocol === 'https:';
8  const client = isHttps ? https : http;
9  
10  return new Promise((resolve, reject) => {
11    const req = client.request(url, {
12      method: options.method || 'GET',
13      headers: options.headers || {},
14      // Force HTTP/1.1 by not using HTTP/2 agent
15      // HTTP/2 requires special agent configuration
16    }, (res) => {
17      if (res.statusCode === 505) {
18        // Server doesn't support HTTP version
19        const upgrade = res.headers.upgrade;
20        reject(new Error(`HTTP version not supported. Server suggests: ${upgrade || 'HTTP/1.1'}`));
21        return;
22      }
23      
24      let data = '';
25      res.on('data', chunk => data += chunk);
26      res.on('end', () => {
27        resolve({
28          status: res.statusCode,
29          headers: res.headers,
30          body: data,
31        });
32      });
33    });
34    
35    req.on('error', reject);
36    
37    if (options.body) {
38      req.write(options.body);
39    }
40    
41    req.end();
42  });
43}
44
45// Usage
46fetchWithHTTPVersion('https://api.example.com/endpoint')
47  .then(response => console.log('Success:', response))
48  .catch(error => console.error('Error:', error.message));
Nginx: Enable HTTP/2 Support
1# Nginx: Configure HTTP/2 support (requires TLS)
2server {
3    listen 443 ssl http2;  # Enable HTTP/2
4    listen [::]:443 ssl http2;
5    server_name api.example.com;
6    
7    # SSL/TLS configuration (required for HTTP/2)
8    ssl_certificate /etc/ssl/certs/api.example.com.crt;
9    ssl_certificate_key /etc/ssl/private/api.example.com.key;
10    
11    # ALPN (Application-Layer Protocol Negotiation) for HTTP/2
12    ssl_protocols TLSv1.2 TLSv1.3;
13    ssl_ciphers HIGH:!aNULL:!MD5;
14    
15    # HTTP/2 settings
16    http2_max_field_size 16k;
17    http2_max_header_size 32k;
18    
19    location /api/ {
20        proxy_pass http://backend;
21        proxy_set_header Host $host;
22        proxy_set_header X-Real-IP $remote_addr;
23        
24        # Pass HTTP version to backend
25        proxy_set_header X-Forwarded-Proto $scheme;
26    }
27}
28
29# Fallback HTTP/1.1 server (if HTTP/2 not available)
30server {
31    listen 80;
32    server_name api.example.com;
33    
34    # Redirect to HTTPS/HTTP/2
35    return 301 https://$server_name$request_uri;
36}

Related Errors

Provider Information

This error code is specific to HTTP services. For more information, refer to the official HTTP documentation.

505 - HTTP Version Not Supported | HTTP Error Reference | Error Code Reference