About this article: This article is reviewed against the cited sources. This is source research, not lab validation. Check the stated versions and your own requirements before making changes.
SSL_ERROR_RX_RECORD_TOO_LONG means the client started a TLS handshake and the server sent back something that is not a TLS record, in most cases an ordinary plain-text HTTP reply. OpenSSL-based tools often print wrong version number for the same fault, although no vendor page states this. The certificate is not the problem. Find out which listener answers on that port without TLS, then enable TLS on it or send the client to the right port.
What the symptom means
The error text comes from the source code of the NSS library (release NSS_3_134_RTM, file SSLerrs.h): "SSL received a record that exceeded the maximum permissible length." TLS 1.3 (RFC 8446, section 5.1) sends data in records whose header is a one-byte type, a two-byte version and a two-byte length. The length "MUST NOT exceed 2^14 bytes", which is 16,384, and the RFC says an endpoint that receives a record that exceeds this length MUST terminate the connection with a record_overflow alert.
A plain-text web server does not send a record header. Its reply starts with the characters HTTP/, which are the bytes 48 54 54 50 2F in hexadecimal. A client that expects TLS reads the first five bytes as a header: type 48, version 54 54, and length 50 2F. The length is 0x502F, which is 5 x 4,096 + 0 x 256 + 2 x 16 + 15 = 20,527 bytes. That is larger than 16,384, so it follows that a client that applies this rule to those bytes finds a record that is too long. The NSS source gives the error text, not the test that raises it. The arithmetic applies when the plain-text service answers with an HTTP response.
The source code of OpenSSL (release openssl-3.0.22, file ssl/ssl_err.c) contains the phrase wrong version number in its error table. The OpenSSL documentation does not say when it is raised. That OpenSSL-based tools print it when the first reply is not a TLS record is common experience, not a vendor statement.
The Apache FAQ lists both mismatches as causes of a connection that hangs: you "try to connect to a HTTPS server (or virtual server) via HTTP", or you try "connect via HTTPS to a HTTP server (eg, using https://example.com/ on a server which doesn't support HTTPS, or which supports it on a non-standard port)". The second matches the case described here.
Likely causes
| Cause | What you see | How to confirm |
|---|---|---|
nginx listen 443; without the ssl parameter |
https:// to the port fails; http:// to the same port works |
nginx -T shows the listen line without ssl; the nginx page says the ssl parameter "must be enabled on listening sockets" |
Apache virtual host on 443 without SSLEngine on |
Same as above | apachectl -S lists the virtual host; its block has no SSLEngine on; mod_ssl says the engine is off by default |
Client URL uses https:// with the port of a plain service (80, 8080, an application port) |
Only that URL fails | curl -I http://host:port/ returns headers |
proxy_pass scheme does not match the back end |
The proxy returns an error to users and the failing client is the proxy | proxy_pass shows https:// for a plain back end, or the reverse |
| Load balancer, port forward or firewall rule sends 443 to a plain port | The service is correct when tested on its own host | openssl s_client from the server itself succeeds, from outside fails |
Prove the cause before changing anything
All of these are read-only.
1. Does the port speak TLS? The openssl s_client manual says -connect host:port selects the target and -brief prints a summary of connection parameters:
openssl s_client -connect app.example.com:443 -brief
A good result is a summary that names a protocol version and a certificate. A bad result is an error instead of a summary (OpenSSL tools commonly print wrong version number).
2. Does the same port answer plain HTTP? The curl manual describes -I as fetching the headers only:
curl -I http://app.example.com:443/
If this prints HTTP response headers, the port is a plain-text listener. If it hangs or fails, the port is not plain HTTP either, and the problem is elsewhere in the path.
3. Which process listens, and on which addresses? The ss manual says -l shows listening sockets, -t TCP, -n numeric ports and -p the processes using them:
ss -ltnp
Look for the port in the local address column and the program name beside it.
4. nginx: read the listen lines. The switches page says -T tests the configuration and dumps the configuration files to standard output. Find the server block for the name and port, and check its listen line:
nginx -T
5. Apache: read the virtual hosts. The httpd manual page says -S shows the settings parsed from the configuration, "currently only shows the virtualhost settings":
apachectl -S
Then read the virtual host's block in its configuration file for SSLEngine on.
Fix
nginx: the listen line has no ssl
The nginx page shows the form: listen 443 ssl; inside the server block, with ssl_certificate and ssl_certificate_key set.
First save the current file (use the file nginx -T shows for the server block; the path here is a placeholder):
cp -p /etc/nginx/conf.d/app.example.com.conf /etc/nginx/conf.d/app.example.com.conf.2026-11-22
Risk: the next edit turns the port from plain HTTP into TLS. Every client that talks plain HTTP to that port, such as a health check, a monitoring probe or a load balancer, will start to fail.
Change the line to listen 443 ssl;. If the server block has no ssl_certificate and ssl_certificate_key lines, add them in the same edit. Check the file, and reload. The switches page says -t tests the configuration and -s reload loads a new one while gracefully shutting down old workers:
nginx -t && nginx -s reload
To undo it: put the saved file back, check it, then reload.
cp -p /etc/nginx/conf.d/app.example.com.conf.2026-11-22 /etc/nginx/conf.d/app.example.com.conf
nginx -t && nginx -s reload
Apache: SSLEngine is off
The Apache ssl_howto page gives the minimum for an HTTPS virtual host: LoadModule ssl_module modules/mod_ssl.so, Listen 443, and a VirtualHost *:443 block holding ServerName, SSLEngine on, SSLCertificateFile and SSLCertificateKeyFile. The ssl_faq page adds that your Listen directives must match your VirtualHost directives.
First save the current file (placeholder path; use the file that holds the virtual host):
cp -p /usr/local/apache2/conf/extra/httpd-ssl.conf /usr/local/apache2/conf/extra/httpd-ssl.conf.2026-11-22
Risk: the next edit makes the virtual host's port TLS-only. Plain HTTP clients on that port fail afterwards.
Add the missing SSLEngine on line, with the certificate file and key file lines if absent, to the virtual host for port 443. Check the file and apply it with a graceful restart, which the apachectl page says does not abort open connections:
apachectl configtest
apachectl graceful
To undo it: restore the saved file, check it, and restart gracefully again.
cp -p /usr/local/apache2/conf/extra/httpd-ssl.conf.2026-11-22 /usr/local/apache2/conf/extra/httpd-ssl.conf
apachectl configtest
apachectl graceful
Wrong URL or port
If step 2 shows the port is a plain-text service, use http:// for it, or point https:// at the port that has TLS. No server change is needed.
A proxy scheme that does not match the back end
The nginx proxy page says the protocol in proxy_pass is "http" or "https". If the back end speaks plain HTTP and proxy_pass says https://, the proxy sends a TLS handshake to a plain port and fails in the same way, and the reverse mismatch fails the other way round.
First save the current file, under a name of its own so that it does not replace a copy saved above (placeholder path):
cp -p /etc/nginx/conf.d/app.example.com.conf /etc/nginx/conf.d/app.example.com.conf.proxy.2026-11-22
Risk: the next edit changes how the proxy reaches the back end. If the new scheme is also wrong, every request through that location fails with an error from the proxy.
Change the scheme in proxy_pass after you repeat step 2 against the back end's own host and port, then check and reload:
nginx -t && nginx -s reload
To undo it: put the saved file back under its original name, check it, and reload.
cp -p /etc/nginx/conf.d/app.example.com.conf.proxy.2026-11-22 /etc/nginx/conf.d/app.example.com.conf
nginx -t && nginx -s reload
A load balancer or forward sends 443 to a plain port
Repeat steps 1 and 2 from the load balancer's own network and against the back-end address. The rule is changed on the device that owns it, through that product's own console.
First record the current rule, by exporting it or taking a screenshot of its target address, port and protocol, and keep the record.
Risk: the next change alters where the device sends traffic for that port. If the new target is wrong, every user of that address and port loses the service.
Set the rule's target port or protocol to the one step 2 showed to speak the protocol the rule expects, then repeat step 1 through the device.
To undo it: set the rule back to the target address, port and protocol in the record you made first, then repeat step 1.
Example (illustrative): web01 serves app.example.com. Browsers show SSL_ERROR_RX_RECORD_TOO_LONG for https://app.example.com/. openssl s_client -connect app.example.com:443 -brief prints wrong version number and no summary. curl -I http://app.example.com:443/ returns HTTP/1.1 response headers, so the port is plain HTTP. ss -ltnp shows nginx on 443. nginx -T shows listen 443; in the server block for app.example.com, which also has ssl_certificate and ssl_certificate_key lines. The engineer saves the file, changes the line to listen 443 ssl;, runs nginx -t and nginx -s reload, and the same openssl s_client command now prints a protocol version and the certificate.
Confirm the fix
openssl s_client -connect app.example.com:443 -briefprints a connection summary with a protocol version and certificate, and no error.curl -I https://app.example.com/returns headers.curl -I http://app.example.com:443/no longer returns the normal page. The curl manual does not describe its result, so use it only to support step 1; it is not proof on its own.- A browser loads the page without the error.
What to watch afterwards
- Health checks and monitoring that used plain HTTP on the changed port.
- A
listenline withhttp2and nossl. The nginx page says HTTP/2 normally needs thesslparameter as well. - A new virtual host copied from a plain-HTTP one: the
sslparameter orSSLEngine onis the part that is easy to leave behind.
Read next
Related articles you may want next.
- TroubleshootingBrowser shows the wrong certificate for a site: SNI and the default virtual hostServer presents another site's certificate? Test SNI with openssl s_client -servername, then fix server_name, default_server or the Apache virtual host.Read article
- TroubleshootingTLS handshake failure: no shared protocol or cipher, read the s_client error and the Schannel eventsslv3 alert handshake failure, no protocols available or Schannel 36874: prove which side lacks a shared TLS version or cipher, fix it and confirm.Read article
- TroubleshootingERR_TOO_MANY_REDIRECTS after turning on HTTPS behind a proxy or CDNRedirect loop after enabling HTTPS behind a proxy or CDN? Trace it with curl -I -L, then fix X-Forwarded-Proto handling or the proxy encryption mode.Read article
Risks and limits
- These commands have not been run or lab-tested.
- The message text varies between clients. This applies to the NSS text and to OpenSSL's
wrong version number. Other clients use their own wording for the same condition. - The 20,527-byte figure applies when the plain-text server's reply begins with
HTTP/. A different plain-text protocol gives a different number but the same kind of failure. - File paths in the examples are placeholders. Save and restore the file your configuration actually reads.
- A listener that mixes plain and TLS on one port is not covered.
Sources
- SSLerrs.h, tag NSS_3_134_RTM — Mozilla NSS source code, fixed tag NSS_3_134_RTM, no date shown, accessed 22 November 2026
- RFC 8446: The Transport Layer Security (TLS) Protocol Version 1.3 — IETF, August 2018, accessed 22 November 2026
- ssl_err.c, tag openssl-3.0.22 — OpenSSL source code, fixed tag openssl-3.0.22, no date shown, accessed 22 November 2026
- openssl-s_client — OpenSSL 3.0 documentation, no date shown, accessed 22 November 2026
- Configuring HTTPS servers — nginx documentation, no date shown, accessed 22 November 2026
- Module ngx_http_core_module, listen — nginx documentation, no date shown, accessed 22 November 2026
- Module ngx_http_proxy_module — nginx documentation, no date shown, accessed 22 November 2026
- Command-line parameters — nginx documentation, no date shown, accessed 22 November 2026
- mod_ssl: SSLEngine — Apache HTTP Server 2.4 documentation, no date shown, accessed 22 November 2026
- SSL/TLS Strong Encryption: How-To — Apache HTTP Server 2.4 documentation, no date shown, accessed 22 November 2026
- SSL/TLS Strong Encryption: FAQ — Apache HTTP Server 2.4 documentation, no date shown, accessed 22 November 2026
- httpd — Apache HTTP Server 2.4 documentation, no date shown, accessed 22 November 2026
- apachectl — Apache HTTP Server 2.4 documentation, no date shown, accessed 22 November 2026
- curl manual — curl project, no date shown, accessed 22 November 2026
- ss(8) — iproute2 manual page, no version date shown (page rendered 2026-09-09), accessed 22 November 2026
- cp(1) — GNU coreutils 9.11 manual page, April 2026, accessed 22 November 2026
This article was originally published on .