V2Ray TLS Handshake and Certificate Errors: Check System Time, SNI, and allowInsecure

Fix V2Ray TLS certificate errors in v2rayN by checking your device clock, SNI, certificate chain, and the risks of allowInsecure.

In this article

For v2rayN connections to standard TLS nodes that report an expired certificate, a name mismatch, or an unknown issuer. First distinguish a subscription download error from a node handshake error, then check system time, server name, and the server's certificate chain in that order. Learn why allowInsecure should remain disabled and how to verify the fix. For REALITY nodes, check the relevant authentication parameters instead of applying standard certificate-chain troubleshooting.

First identify whether the error comes from a subscription or node connection

When you see a TLS error, note what you were doing when it occurred. An HTTPS certificate error while updating a subscription usually concerns the subscription URL. A handshake error in the core logs while using a selected node to access a webpage may concern the proxy node. These connections use different destination domains, so changing the node's SNI will not fix the subscription site's certificate.

Resolve destination address Establish TCP connection Perform TLS handshake Verify certificate Authenticate proxy protocol

A standard TLS proxy connection follows this sequence. A successful TCP connection to the port only proves that a service responded; it does not prove the certificate is valid, proxy authentication succeeded, or a webpage will load. VMess and VLESS are proxy protocols; TLS is an optional transport security layer, and not every node uses it.

Use the exact error message to guide your checks

Different core implementations and versions may wrap errors with extra connection details. Look for the innermost x509 or tls cause rather than repeatedly restarting the client based only on an outer “connection failed” message. The examples below are common error messages; actual logs may include certificate dates or specific domains.

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

Cause: The device's clock is outside the certificate's validity period. The device time may be wrong, or the server certificate may have expired.

Fix: Sync the system clock first, then check the certificate's start and expiration dates. If it has expired, the server administrator must renew it and reload the service.

Error: x509: certificate signed by unknown authority

Cause: The certificate chain cannot be traced to a trusted root. Common causes include a missing intermediate certificate, a self-signed certificate, or a problem with the trust store.

Fix: Check the certificate chain served by the server, then check the device's trust store. Never install a root certificate from an untrusted source.

Error: x509: certificate is valid for example.com, not www.example.com

Cause: The server name used for verification is not included in the domains permitted by the certificate. The domains here are examples only.

Fix: Check the SNI provided by your node provider against the certificate's SAN. Don't add or remove www arbitrarily.

Error: remote error: tls: handshake failure

Cause: The remote server terminated the handshake. Possible causes include SNI, TLS parameters, client authentication requirements, or server policy; this message alone does not mean the certificate is untrusted.

Fix: Check the connection settings and use server logs to pinpoint the cause. Enabling certificate verification bypass alone usually won't resolve a handshake rejected by the remote server.

Sync the system clock, then check whether the certificate has expired

TLS verification checks the actual point in time. Changing only the time zone shown in the taskbar does not ensure the device clock is correct; conversely, a different displayed time zone does not necessarily cause certificate errors. Sleep and wake cycles, a failing motherboard battery, or manually changing the date can all throw the clock off.

  1. Check the date

    In Windows 11, open Settings → Time & language → Date & time. Check the year, month, and day first, paying particular attention to the year.

  2. Sync the clock

    Turn on Set time automatically, then select Sync now under Additional settings. If syncing fails, troubleshoot the network or time service first. An enabled automatic setting does not mean the clock has synced successfully.

  3. Retry the connection

    Return to v2rayN, re-enable the current node, and make a request. Check the logs with the new timestamp rather than using an old error to judge whether the fix worked.

  4. Check the validity period

    If the certificate still appears expired, check its notBefore and notAfter values. If the device time is correct but outside the certificate's validity period, ask the server administrator to update the certificate.

On Android, search Settings for Date & time, enable automatic time, then retry v2rayNG or v2flyNG. Menu locations vary by device; the key is to confirm the actual date after syncing, not just toggle the setting. Don't roll the system clock back into the certificate's validity period as a long-term fix.

Check the SNI, connection address, and transport Host

SNI is the name sent to the server during the TLS handshake, which the server can use to select a certificate. In standard TLS settings, serverName is also typically used to specify the name to verify against the certificate. “Fake domain” can mean different things: it may refer to TLS SNI or the WebSocket Host. Confirm which field is meant before changing anything.

FieldPurposeWhat to check
Server addressSpecifies the remote host to connect toDoes the domain or IP point to the correct endpoint?
Server portSpecifies the remote service to connect toDoes it match the provider's settings, such as 443?
SNI / serverNameAffects TLS name selection and verificationDoes it match the target service and certificate SAN?
WebSocket HostAffects virtual host routing for HTTP requestsThis is not a certificate verification switch for standard TLS
WebSocket pathMust match the server's transport endpointA wrong path may result in an HTTP status error

In the v2rayN main window, double-click the node, then check Address and Port in the node editor, followed by SNI and the certificate verification bypass setting in the TLS section. Labels may vary slightly by version. Don't change global options under Settings → Parameter settings as a substitute for checking this node's settings.

When you use an IP address to connect, you may still need to enter the domain specified by your provider as the SNI. To verify a certificate against an IP address, the certificate must include a matching IP-type SAN; a certificate containing only a domain name won't satisfy this requirement. Wildcards also have limits: *.example.com typically does not cover example.com or a.b.example.com.

Keep in mind: Don't put a webpage domain in SNI at random

Get the server name confirmed by your node provider, then compare it with the certificate SAN. A domain that opens in a browser isn't necessarily valid as a proxy node's SNI, and a correct HTTP Host does not replace TLS name verification.

Check the full certificate chain and what the server actually returns

Servers usually need to send the leaf certificate and any required intermediate certificates; the client's trust store typically supplies the root certificate. A setup with only the leaf certificate may work in some environments but fail with an unknown issuer on another device. Browsers may cache intermediate certificates, so a site opening in a browser does not by itself prove the server's chain is complete.

If you manage the server, run the following command in an environment with OpenSSL installed. example.com is a reserved example domain. Replace both instances with the actual TLS domain and replace the port with the node's actual port before running the command. It checks the standard TLS endpoint; it does not verify subsequent VMess or VLESS authentication.

openssl s_client -connect example.com:443 -servername example.com -verify_hostname example.com -verify_return_error -showcerts

Understand allowInsecure: Keep verification on; don't use a switch to hide the problem

allowInsecure controls whether standard TLS certificate verification is skipped. When set to true, the connection may still be encrypted, but the server's identity is no longer protected by normal certificate chain and name verification. This does not fix the certificate, nor does it guarantee that you are connecting to the intended server.

The following is only a tlsSettings snippet from a standard TLS outbound configuration, not a complete node you can import. Replace the example domain with the real server name. For nodes managed through a subscription, fix the source configuration whenever possible to avoid having local changes overwritten at the next update.

{
  "tlsSettings": {
    "serverName": "example.com",
    "allowInsecure": false
  }
}

Verify the fix: Test again with verification restored

Keep allowInsecure set to false, reconnect, and confirm the certificate error is gone. Then check webpage access and the expected exit route. If the connection works only when verification is bypassed, the problem is not fixed.

Common questions and post-fix checks

Should I change the node's SNI if a certificate error appears when updating a subscription?

Don't change the node first. Check the subscription URL's domain, the device time, and the certificate for that HTTPS service. If the update explicitly goes through a proxy, test the proxy connection and subscription site separately to identify which layer is failing.

My PC works, but Android says the certificate is untrusted. What should I do?

Compare the address, port, SNI, and certificate verification setting on both devices first, then check Android's system time and system updates. If the settings match, ask the administrator to check for a missing intermediate certificate. Don't install a root certificate from an unknown source on the device.

Does a failed REALITY connection mean I need to add an intermediate certificate?

Don't apply the standard TLS troubleshooting steps directly. First confirm that the node's security type is REALITY, then check the server name, public key, shortId, and other provider-required parameters, as well as core compatibility. Enabling allowInsecure cannot replace these authentication parameters.

It connected once after I made a change. How can I confirm it's fixed?

Keep certificate verification enabled, restart the current connection, and make several real webpage requests. Check the new logs for the same error, then confirm the scope of your system proxy or TUN settings. A TCP latency reading alone doesn't verify any of this.

Keep a brief record of what triggered the issue, the full error type, each setting changed, and the time and result of your retest. If the problem persists, send the record and redacted logs to the server administrator, asking them to check the certificate returned by the actual endpoint rather than just reporting that the “node doesn't work.” For steps to verify that the proxy is active, see the connection testing guide.

Download v2rayN