Secure Connection Failed in Firefox: what it means and how to fix it
Secure Connection Failed is the page Firefox shows when it could not set up an encrypted connection to a site at all. It is a heading, not a diagnosis: the cause is in the error code under it, such as PR_END_OF_FILE_ERROR or SSL_ERROR_RX_RECORD_TOO_LONG [1][2]. The code says what Firefox received, not who sent it, so one test from another network decides whether the visitor or the site's owner has to act. This page explains how to read the code, what to try as a visitor, and what the owner has to fix. It is part of the SSL errors section.
Quick facts
- Browser
- Firefox; the tab title reads
Problem loading page[1] - Exact text
Secure Connection Failed, thenAn error occurred during a connection to example.com.with a short description and a lineError code:[1][2]- What failed
- the connection or the TLS handshake, or a certificate check Firefox does not let you override, such as a pinning failure; other certificate problems appear on a different page [2]
- Can you click through
- no; the page offers
Try Again, or for some codesRestore default settings, and nothing that opens the site [1][2] - Who fixes it
- either side; the code and one test from another network, without a proxy or VPN, tell which
Where to find the error code
The code is on the page itself, in the line that starts with Error code:, for example Error code: PR_END_OF_FILE_ERROR. The sentence above it gives Firefox's description of the same error [1][2]. Everything below depends on the code, so read it before trying fixes.
Firefox has two different error pages, and it matters which one you see. Secure Connection Failed means the connection or the TLS handshake failed and Firefox offers no way past it. Warning: Potential Security Risk Ahead means the connection worked and the site's certificate failed a check you can override. That page hides its code until you click Advanced…, and then shows a code such as SEC_ERROR_UNKNOWN_ISSUER and a button Accept the Risk and Continue [1][2]. That second page is covered on Your connection is not private, which treats the same certificate problems across browsers.
The error codes and what they mean
Each row was reproduced against a test server; the description is the one Firefox printed above the code [1][3].
| Error code | Firefox's description | What happened | Where to read more |
|---|---|---|---|
PR_ | none, the code only | the other side read Firefox's first message and closed the connection | below |
SSL_ | SSL received a record that exceeded the maximum permissible length. | the port answered in plain HTTP, not TLS | below |
PR_ | none, the code only | the other side reset the connection | below |
SSL_ | Cannot communicate securely with peer: no common encryption algorithm(s). | no cipher suite both sides accept | cipher mismatch |
SSL_ | Peer reports incompatible or unsupported protocol version. | the server supports only TLS versions older than 1.2 and refused Firefox's | cipher mismatch |
SSL_ | Peer using unsupported version of security protocol. | the server answered with an old TLS version that Firefox does not accept | cipher mismatch, TLS versions |
For the last two codes Firefox adds a sentence of its own: This website might not support the TLS 1.2 protocol, which is the minimum version supported by Firefox. [1][2]
In Chrome and Safari
Chrome does not use the words "Secure Connection Failed", and it splits the same faults over two pages. Against our test servers it showed ERR_SSL_PROTOCOL_ERROR for plain HTTP and ERR_SSL_VERSION_OR_CIPHER_MISMATCH for the three version and cipher cases [1]; Chrome puts both under This site can’t provide a secure connection [7]. The two closed connections gave ERR_CONNECTION_CLOSED and ERR_CONNECTION_RESET [1], which Chrome shows under This site can’t be reached [7]. Safari has its own wording; see Safari can't establish a secure connection.
PR_END_OF_FILE_ERROR
The connection ended in the middle of the handshake. Firefox sent its opening message, and the other side closed the connection without a usable answer. In our test a server that read that message and closed the connection produced exactly this code; Chrome showed ERR_CONNECTION_CLOSED for the same server [1]. The code does not say who closed it, so the cause is found by elimination.
One candidate is the site's server. For the visitor's side, Chrome's desktop error page for the same fault, ERR_CONNECTION_CLOSED, suggests Checking the proxy and the firewall [7].
As a visitor: try another network, then the VPN, the antivirus HTTPS scanning and the proxy one at a time, as in the fixes below.
As the site owner: if the site fails from several networks, test from outside with
openssl s_client, shown below. A connection closed without any reply points at the server, or at whatever answers on port 443 in front of it.
SSL_ERROR_RX_RECORD_TOO_LONG
Firefox expected the start of a TLS handshake and received something it could not read as TLS: plain HTTP answering on the HTTPS port [1]. Firefox reads the first five bytes of any reply as a TLS record header, and bytes four and five as the length of the record [3]. Plain text there gives a large number. In our test the reply began with <!DOCTYPE, and its letters OC read as a length of 20291 bytes [1]. Firefox rejects a record longer than the limit of 2^14 + 2048 bytes set in RFC 5246, section 6.2.3, and reports this code [3][4].
The cause is on the server. nginx serves TLS on a port only when its listen line carries the ssl parameter [5]. Apache needs SSLEngine on in the virtual host for port 443 [6]. The third case is a load balancer or proxy on port 443 that answers in plain HTTP. The fixes are on installing on nginx and installing on Apache. The same fault appears in Chrome as ERR_SSL_PROTOCOL_ERROR [1].
PR_CONNECT_RESET_ERROR
The connection was reset before the TLS handshake finished. The NSPR library behind Firefox describes this code as TCP connection reset by peer [3]. In our test a server that read Firefox's first message and answered with a TCP reset produced it; Chrome showed ERR_CONNECTION_RESET [1]. The reset can come from the server, or from a firewall or filter that blocks the connection on the way. Trying another network shows quickly whether the block is local.
Fixes for visitors
Note the error code first, then work through these in order. The first step alone separates the visitor's side from the site's side: if Secure Connection Failed stays on another network and another device, only the site's owner can fix it.
Try another network. Switch from Wi-Fi to mobile data, or the reverse. If the site loads there, the cause is the first network or software on your device.
Press Restore default settings if the page shows it. For the version and cipher codes in the table, such as
SSL_ERROR_NO_CYPHER_OVERLAP, Firefox puts this button in place ofTry Againwhen it finds changed security settings [2]. In our test, turning off one cipher onabout:configwas enough to get it [1].Turn off HTTPS scanning in antivirus software for a moment. If the site loads, turn scanning back on and add an exception for the site.
Proxy, VPN and DNS over HTTPS
Turn off a VPN or proxy. In Firefox, open Settings, General, Network Settings, Settings…, and in Connection Settings choose No proxy or Use system proxy settings [2].
Try with DNS over HTTPS turned off. Choose Off under Settings, Privacy & Security, DNS over HTTPS [2]. With it on, Firefox can take the site's address from the provider chosen there instead of your default DNS resolver [2]. If the site loads with it off, pick another provider rather than leaving the feature off; if the error code stays the same, turn it back on.
Do not lower Firefox's minimum TLS version to open a site: the setting applies to every site you visit, and for SSL_ERROR_UNSUPPORTED_VERSION the fix is on the server.
How the site owner diagnoses it
Test from outside the server, against the hostname visitors use:
$ openssl s_client -connect example.com:443 -servername example.com </dev/null
$ curl -v https://example.com/wrong version number from either tool means plain HTTP on port 443, the SSL_ERROR_RX_RECORD_TOO_LONG case. A connection closed with no reply means the server or a front end dropped the handshake, the PR_END_OF_FILE_ERROR case; check the server's logs and the configuration for that hostname. An alert such as protocol version or handshake failure points at versions and ciphers, covered on cipher mismatch. More commands are on OpenSSL commands, and reading handshake alerts is on SSL handshake failed.
What each fault looked like in our test
Firefox, OpenSSL 3.0 and curl against the same test servers [1]:
| Fault | Firefox | openssl s_client | curl |
|---|---|---|---|
| plain HTTP on the TLS port | SSL_ | wrong version number | exit 35, wrong version number |
| closed after the first message | PR_ | unexpected eof while reading | exit 35, SSL_ |
| reset after the first message | PR_ | write:errno=104 | exit 35, Connection reset by peer |
| server with TLS 1.0 only | SSL_ | tlsv1 alert protocol version | exit 35, tlsv1 alert protocol version |
| server that answers TLS 1.0 whatever the client offers | SSL_ | unsupported protocol | exit 35, unsupported protocol |
| one cipher only, TLS 1.2 only | SSL_ | connected | connected |
The last row matters. A clean openssl s_client connection does not clear the server: OpenSSL offered the one cipher this server allowed, while Firefox and Chrome could not connect [1]. Compare the server's cipher list with what browsers offer, as described on cipher mismatch. In the plain HTTP case, our test server logged each attempt as a 400 bad request with binary bytes where the request line should be: the TLS handshake read as HTTP [1].
FAQ
What does Secure Connection Failed mean in Firefox?
Firefox could not set up an encrypted connection to the site. The error code on the page names the reason, for example PR_END_OF_FILE_ERROR for a connection closed during the handshake or SSL_ERROR_RX_RECORD_TOO_LONG for plain HTTP on the HTTPS port.
How do I fix Secure Connection Failed?
Try another network first. If the site works there, check antivirus HTTPS scanning, a VPN or proxy and DNS over HTTPS, and press Restore default settings if the page offers it. If it fails everywhere, the site's owner must fix the server.
Can I bypass Secure Connection Failed?
No. The page has no button that opens the site, because no secure connection exists to accept. The certificate warning page, Warning: Potential Security Risk Ahead, is the one with an Accept the Risk and Continue button.
What is PR_END_OF_FILE_ERROR?
The connection was closed during the handshake, without an answer Firefox could use. The code does not say who closed it. On the site's side it can be the server or a front end in front of it; for the visitor's side, Chrome's desktop error page for the same fault suggests checking the proxy and the firewall. [7]
What causes SSL_ERROR_RX_RECORD_TOO_LONG?
The server sends plain HTTP on port 443. In nginx the listen line lacks ssl; in Apache the virtual host lacks SSLEngine on.
Is Secure Connection Failed the same as Your connection is not private?
No. Secure Connection Failed means the encrypted connection could not be set up. A certificate problem you can override appears on a different Firefox page, Warning: Potential Security Risk Ahead, and in Chrome as Your connection is not private.
Sources
Our test setup: Firefox 147 and Chrome 156 in headless mode, OpenSSL 3.0, curl and Python test servers, with certificates from a test authority of our own.
Mozilla Firefox 147 source: toolkit/content/aboutNetError.mjs, toolkit/locales/en-US/toolkit/neterror/certError.ftl and netError.ftl (error page logic, texts and buttons); browser/locales/en-US/browser/preferences/preferences.ftl, connection.ftl and browser/components/preferences/preferences.xhtml (Settings labels).
Mozilla NSS and NSPR in the Firefox 147 tree: security/nss/lib/ssl/SSLerrs.h (error descriptions), security/nss/lib/ssl/ssl3gthr.c (record length check), nsprpub/pr/include/prerr.h.
IETF, RFC 5246, The TLS Protocol Version 1.2, section 6.2.3.
nginx documentation, Configuring HTTPS servers.
Apache HTTP Server 2.4 documentation, mod_ssl, SSLEngine.
Chromium, net/base/net_error_list.h, components/error_page/common/localized_error.cc and components/error_page_strings.grdp.