How to Fix ERR_SSL_INVALID_ALPN_PROTOCOL Error
The ERR_SSL_INVALID_ALPN_PROTOCOL error happens when the ALPN protocol fails during the SSL/TLS handshake due to misconfiguration, unsupported protocols, or outdated software. This guide explains causes, troubleshooting steps, and tools like OpenSSL and SSL Labs to fix the issue by updating configurations, certificates, or software.
Use our free chatbot to get step-by-step help with solving technical issues.
Summary of Key Points
| Point | Description |
|---|---|
| Error Description | The error occurs when the ALPN protocol parameter is unsupported or misconfigured. |
| Possible Causes | Incorrect server configuration, invalid certificates, outdated software versions. |
| Required Actions | Check server settings, update, debug, and test connections. |
| Useful Tools | OpenSSL, Curl, SSL testing platforms like SSL Labs, server log files. |
Step-by-Step Guide
1. What is the ERR_SSL_INVALID_ALPN_PROTOCOL error, and why does it occur?
The ERR_SSL_INVALID_ALPN_PROTOCOL error indicates that the server and client could not agree on a supported protocol via ALPN (Application-Layer Protocol Negotiation) during the SSL/TLS handshake.
ALPN at a glance:
- Allows negotiation of which protocol (e.g., HTTP/1.1, HTTP/2) to use during the handshake.
- Often needed for HTTP/2 implementation or with modern browsers.
- Occurs due to issues like incorrect server configuration, unsupported ALPN protocols, or outdated software.
2. Check Systems and Platforms
Perform basic tests before making changes:
-
Browser Error Messages:
- Use an up-to-date browser (e.g., Chrome or Firefox).
- Check the error message in the console log (F12 → “Console”).
-
Test Server Communication:
curl -v --http2 https://example.comIf
HTTP/2is not supported, it suggests an issue with ALPN. -
Access SSL Testing Services:
- Use SSL Labs Test to analyze certificate and protocol support.
3. Check Server Configuration
3.1 Apache Web Server:
If using Apache, check the activation and protocol support in the VirtualHost configuration:
<VirtualHost *:443>
ServerName example.com
# Explicitly enable ALPN-supported protocols
Protocols h2 http/1.1
# Enable SSL
SSLEngine on
SSLCertificateFile /path/to/your/cert.pem
SSLCertificateKeyFile /path/to/your/key.pem
</VirtualHost>
- Tip: HTTP/2 requires ALPN, so the protocol option
h2must be enabled. - Debugging: Check error logs:
tail -f /var/log/apache2/error.log
3.2 Nginx Web Server:
For Nginx, ALPN is enabled by default but requires correct TLS configuration.
server {
listen 443 ssl http2;
server_name example.com;
# Paths to certificates
ssl_certificate /path/to/your/cert.pem;
ssl_certificate_key /path/to/your/key.pem;
# Optional: Explicitly configure ALPN
ssl_protocols TLSv1.2 TLSv1.3;
}
- Note: Use
http2in thelistendirective to enable HTTP/2.
3.3 IIS (Microsoft Internet Information Services):
If using IIS:
- Update the IIS server to the latest version.
- Explicitly enable HTTP/2 via the
netshcommand-line tool or IIS settings.
4. Check SSL/TLS Certificates
Misconfigured or expired SSL certificates often cause protocol negotiation issues:
-
Use an SSL tool like OpenSSL:
openssl s_client -connect example.com:443 -alpn h2Check the ALPN negotiation in the output.
-
Automatically Renew HTTPS Certificates:
If using Let’s Encrypt, ensurecertbotis properly configured. -
Recommended CA Providers: If you need a renewed certificate, consider providers like DigiCert or GlobalSign.
5. Software Updates
Update your software to ensure known bugs in older versions are resolved:
-
Update the Web Server (Apache/Nginx):
sudo apt-get update && sudo apt-get upgrade -
Check and Update SSL/TLS Libraries:
- OpenSSL:
openssl version sudo apt install openssl
- OpenSSL:
6. Test ALPN Protocol Handshake
To ensure ALPN works correctly, use browsers or debugging tools:
-
Test with curl:
curl --http2 -k https://example.com -
Browser-Specific Tool: Use Chrome DevTools:
- Go to Network and check the protocol column (HTTP/2 should be visible).
Recommended Tools for Troubleshooting
- SSL Labs Test: Test here
- Wireshark: For analyzing network traffic.
- Affiliate Recommendation: For additional security, consider NordVPN:
NordVPN Security Solutions
FAQ: Frequently Asked Questions
1. What causes the ERR_SSL_INVALID_ALPN_PROTOCOL error?
- The error occurs due to server configuration issues, unsupported protocols, or outdated software.
2. Which protocol does ALPN use?
- ALPN is primarily used for negotiating HTTP/2.
3. How can I ensure my certificate is valid?
- Use tools like SSL Checker or OpenSSL.
4. Do all web servers need to support ALPN?
- Not all web servers support ALPN by default; activation and software version are crucial.
5. Can an outdated OpenSSL version cause the problem?
- Yes. Use at least OpenSSL 1.0.2, as older versions do not support ALPN.
