v2rayN TLS Handshake Failed or Certificate Error: Troubleshooting System Time, SNI, and allowInsecure

TLS handshake failures and certificate errors in v2rayN often stem from an incorrect system clock, an SNI name that doesn’t match the certificate, or an ALPN mismatch. Find the cause and fix it with these steps.

At a glance

For users who can launch v2rayN but get a TLS error when connecting to a specific node. Start with the raw error in the core log, then check for clock skew, a certificate name or trust-chain issue, or failed application protocol negotiation. Change one setting at a time and retest the same node. Keep certificate verification enabled throughout.

First, identify which connection is failing

For standard TLS nodes over TCP, the core connects to the node’s entry point before sending the TLS handshake. SNI and ALPN are negotiated during the handshake, when the client also verifies the server certificate. Once the handshake succeeds, communication continues over the configured transport. The flow below shows troubleshooting stages, not the exact order of handshake messages.

Address resolutionPort connectionHandshake negotiationCertificate verificationTransport request
  • Node connection fails: In the v2rayN 7.x desktop interface, select the affected node in the server list, set it as the active server, and trigger a request. Check the core output in the main window log for the same timestamp. connection refused occurs during the TCP connection phase; it does not indicate an expired certificate.
  • Subscription update fails: If the certificate error occurs only while updating a subscription, note the subscription host shown in the update log. That HTTPS request verifies the subscription server’s certificate, not the node server’s. Changing the node’s SNI won’t fix a certificate error for the subscription URL.
  • Only the browser reports an error: Check the target domain shown on the browser’s error page and compare it with the core log from the same time. If the error is for the target website, don’t use that website’s domain to overwrite the node settings.

System time: distinguish clock skew from an expired certificate

Certificates have validity start and expiration times, which are checked against the actual time represented by the system clock. A time zone changes how the time is displayed, but choosing the wrong time zone and then manually adjusting the clock to look right can cause the actual time to be off. If the log shows both current time and certificate validity limits, convert the timestamps with their time zone offsets to the same time zone before comparing them.

  1. Check the date and time zone

    In Windows 11, open Settings → Time & language → Date & time and check the date and current time zone. Pay particular attention to date changes after waking from sleep, switching operating systems, or replacing the motherboard battery.

  2. Sync the system clock

    Turn on Set time automatically, then select Sync now on the same page. If the device is managed by an organization or the button is unavailable, keep the sync failure message and ask your administrator to check the system time policy. Don’t try to hide the problem by repeatedly changing the clock manually.

  3. Check the certificate validity period

    For example, a sample certificate becomes valid at 2026-09-24 00:00 UTC. If your computer shows 2026-09-24 07:55 UTC+08:00, that converts to 23:55 UTC on the previous day—five minutes too early. The dates may look the same in both places, but that doesn’t mean the certificate is valid yet.

  4. Retry the same node

    After syncing the clock, leave the node settings unchanged, reconnect, and check the new log. If the correct time is still past the certificate’s expiration, ask the node administrator to renew it and confirm that the renewed certificate is loaded at the actual entry point.

SNI and ALPN: check each node setting

In v2rayN, double-click the relevant node in the server list to open its settings, then find the TLS fields. Field names can vary between 7.x versions and node types; use the labels shown in your interface, such as SNI, serverName, or ALPN. This section covers standard TLS and does not treat these settings as universal options for other security modes.

FieldPurposeWhat to check
Address and portDetermine the entry point the core actually connects to.Use the values provided by the node provider. 443 is a common TLS port, but not every node listens on it.
SNITell the server which site’s certificate to select during the handshake.Enter the TLS hostname specified by the provider, such as edge.example.net. Don’t include https://, a port, or a path. The certificate’s SAN must cover the name the client verifies.
ALPNNegotiate the application-layer protocol used over the TLS connection.If this is explicitly configured, use the values specified for both ends. gRPC uses HTTP/2, so check for h2 over TLS. For a traditional HTTP/1.1 WebSocket upgrade, check that the entry point supports http/1.1.
Host and pathUsed for the HTTP request or entry-point routing for the relevant transport.Check these separately in the applicable transport settings. Changing the WebSocket Host or path does not correct the TLS SNI.

The connection address may be an IP address, while the server’s certificate may cover only a domain name. In that case, keep the connection address provided by the provider and enter the specified TLS hostname separately. If SNI isn’t set explicitly, the name used depends on the generated configuration and the core’s default behavior. A blank field doesn’t mean the correct certificate will be found automatically.

If the log explicitly says there is no common ALPN protocol, check that the node transport type matches the TLS termination entry point. If TLS succeeds and a 404 appears afterward, check the path or entry-point routing first instead of repeatedly changing ALPN.

Common TLS errors and how to fix them

Higher-level logs may wrap the cause in a generic connection failure message. Look for a more specific x509: or tls: detail in the same error chain. These are common core error snippets; prefixes and additional details vary by core version and connection scenario.

Error: x509: certificate has expired or is not yet valid

Cause: The verification time is outside the certificate’s validity period. Fix: Correct the system clock first, then use the log to determine whether the certificate is not yet valid or has expired. If the clock is correct, the administrator must replace or deploy a suitable certificate.

Error: x509: certificate is valid for

Cause: The error usually lists the names allowed by the certificate and says the name the client is verifying isn’t one of them. Fix: Check the specified SNI. If it’s correct, confirm that the entry point returns the right certificate for that name. Don’t switch to a name that happens to appear in the certificate.

Error: x509: certificate signed by unknown authority

Cause: The core can’t build a certificate chain to a trusted root. Fix: Ask the administrator to confirm that the entry point provides the complete intermediate certificate chain. If this happens only on a managed network or device, ask your administrator to check the trust source used by the core and the organization’s policies.

Error: remote error: tls: no application protocol

Cause: The remote peer reports that there is no mutually supported application-layer protocol. Fix: Check the ALPN settings against the node transport type and TLS entry-point configuration. Don’t enable every protocol just to see if it works.

Error: tls: first record does not look like a TLS handshake

Cause: The first record received by the client doesn’t look like TLS. This commonly happens when connecting to a plaintext port or the wrong entry point. Fix: Check the port mapping and where TLS terminates, and confirm that the client is connecting to a port that serves TLS externally.

allowInsecure and verifying the fix

allowInsecure, in standard TLS configurations that support it, skips normal server certificate verification. It won’t fix the system clock, complete a certificate chain, or negotiate an ALPN protocol supported by both sides. The connection may still be encrypted, but without verification you can’t reliably confirm the peer’s identity. Keep this setting disabled while troubleshooting and retesting.

Why does the node report a certificate error when the domain opens in my browser?

First compare the hostname, entry address, and port used by the two requests. The browser may resolve the domain to a different address or use a different trust store than the core. Compare the verification name in the log with the SNI specified by the node provider. Don’t use a single browser visit as a substitute for retesting the node.

Only this Windows PC can’t connect. What should I check first?

Compare the system’s actual time and the address and TLS settings for the same node against a working device, then check whether both devices are on the same network. If only this device reports an unknown certificate authority, note whether it’s managed by an organization and ask your administrator to check the trust settings. Don’t import certificates from unknown sources via a pop-up or chat attachment.

What if the error returns after I fix the SNI manually and update the subscription?

Open the updated node’s settings and check whether the subscription has overwritten the SNI, port, or transport type. If the provider is still sending outdated settings, report the differences so they can update them upstream. Don’t include the subscription URL or node share link in your support request.

How can I tell whether the connection recovered without an automatic node switch?

Make sure the affected node is still the active server, keep certificate verification enabled, and send a new request. Match its timestamp with the core log, and confirm that the request succeeded without the same TLS error. A change in latency alone doesn’t prove the original node is working again.

Download client