What the message looks like
Secure Connection Failed – Error code: SSL_ERROR_RX_RECORD_TOO_LONGCommon causes
- nginx has
listen 443;withoutssl. - Apache virtual host on *:443 without
SSLEngine on. - Port forwarding on the router or load balancer maps 443 to HTTP port 80.
- Another service (e.g. an app without TLS) occupies port 443.
- TLS termination disabled in the proxy, backend speaks HTTP only.
Check
- Test with HTTP on port 443 – if HTML comes back, the server speaks no TLS
curl -s --max-time 5 http://example.com:443/ | head -c 300 - Test the TLS handshake directly (“wrong version number” confirms it)
- Show listen lines for 443 in the active config
nginx -T 2>/dev/null | grep -nE '^\s*listen .*443' - Find the process on port 443
ss -ltnp | grep ':443 '
Fix
- In nginx set
listen 443 ssl;andlisten [::]:443 ssl;, plusssl_certificateandssl_certificate_key. - In Apache enable
SSLEngine onin the 443 virtual host and loadmod_ssl. - Check port forwards: external 443 must map to an internal TLS port.
- Then run
nginx -t && systemctl reload nginxorapachectl configtest && systemctl reload apache2.
Typical scenario
A new nginx vhost was copied from an HTTP template; the admin enters listen 443; and forgets the ssl parameter. Firefox shows 'SSL_ERROR_RX_RECORD_TOO_LONG', Chrome 'ERR_SSL_PROTOCOL_ERROR'. A test with curl -v http://example.com:443 suddenly returns a normal HTTP response: the server speaks plain text on port 443. So first check with nginx -T | grep -n 'listen' whether the affected vhost carries ssl.
FAQ
What is the error called in Chrome?
Chrome usually shows ERR_SSL_PROTOCOL_ERROR, curl says “wrong version number”. Same cause: plain text on a TLS port.
Is http2 in the listen line enough?
No. Without ssl nginx listens unencrypted. Since nginx 1.25.1 you enable HTTP/2 separately with http2 on;.
Why do Firefox and Chrome name different errors?
Both detect the same problem: HTTP text comes back in answer to the TLS request. Firefox reads those bytes as an oversized TLS record, Chrome reports a general protocol error. openssl s_client shows the same as 'wrong version number'.
Can Docker be the cause?
Yes. If host port 443 is forwarded to container port 80, the container speaks plain text where TLS is expected. The mapping has to point to the container port where TLS is actually terminated, or TLS has to be handled in front of it.
Is it enough to set ssl on;?
No, the ssl on directive has been removed in modern nginx versions. Instead, ssl belongs on the listen line, for example listen 443 ssl;, together with ssl_certificate and ssl_certificate_key.