TLS Certificate Errors: Fix System Time and SNI Issues

Fix TLS certificate and handshake errors by checking your device clock, SNI and Host settings, allowInsecure, and the client fingerprint.

At a glance

This guide covers certificate verification failures and interrupted TLS handshakes in v2rayN, v2rayNG, and v2flyNG. Use the logs to distinguish clock, hostname, and trust-chain errors, then check the node’s server address, SNI, and transport Host. Troubleshoot standard TLS and REALITY separately. Change one field at a time, keep certificate verification enabled, and confirm recovery with a real connection.

1. Start with the logs: a certificate error doesn’t mean the port is unreachable

The TLS handshake happens after the transport connection is established. A successful TCP connection only shows that the destination port responds; it doesn’t prove the certificate is trusted, the hostname matches, or proxy authentication succeeded. It’s possible for TCPing in v2rayN to succeed while a real connection test fails. Don’t keep changing the local proxy port as a result.

Note the client name and version, the core version actually in use, the node’s security type, and when the failure occurred. Stop repeated background tests and try connecting to just one node once. In the logs, find the most specific error from that same time. An outer error like failed to find an available destination is only a summary; check the details that follow it.

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

Cause: The device clock is outside the certificate’s validity period, or the server certificate has actually expired. Fix: Sync the device clock, then check the certificate’s validity dates. If the clock is correct and the error persists, the server operator needs to renew the certificate or fix its deployment.

Error: x509: certificate signed by unknown authority

Cause: The certificate chain can’t be established. Common causes include a missing intermediate certificate, a self-signed certificate, or certificate replacement somewhere on the network. Fix: Check the issuer and full certificate chain. Don’t simply disable verification.

Error: remote error: tls: handshake failure

Cause: The remote server rejected the handshake. Possible causes include SNI, the protocol version, a required client certificate, or server policy. Fix: Check the required security type and SNI first, then consult the server logs. This error alone doesn’t mean the certificate has expired.

2. Sync the system clock: check the date, time zone, and certificate validity

Certificates have notBefore and notAfter dates. Validation uses the absolute time from the system clock, not just the hour shown in the taskbar. Changing the time zone while keeping the absolute time correct usually won’t invalidate a certificate. Manually setting the local clock to a time in another time zone, however, can create an offset of several hours.

  1. Check the date

    First, confirm the year, month, and day are correct. After a long shutdown, restoring a snapshot, or a motherboard clock problem, a device may revert to an earlier date. Don’t just adjust the minutes until the time looks close.

  2. Sync the desktop clock

    On Windows 11, go to Settings → Time & language → Date & time, turn on Set time automatically, check the time zone, then select Sync now. On macOS, go to System Settings → General → Date & Time and turn on automatic date and time.

  3. Sync the Android clock

    On Android, this is usually under Settings → System → Date & time. Turn on automatic time and automatic time zone. Menu names vary by device; search Settings for “date and time” if needed.

  4. Retry and record the result

    Once the clock has synced, reconnect with the client. If the certificate still appears expired, record the current time shown in the error and the certificate’s validity period. Ask the node operator to check the certificate actually served by the server.

On Windows, run w32tm /query /status in a terminal to check time synchronization. The sync command w32tm /resync usually requires administrator privileges and depends on the Windows Time service. If it fails, check the service and network; running the command doesn’t mean the clock synced. On Linux, use timedatectl status to check the system clock and time synchronization service. How to enable synchronization depends on the distribution.

Bottom line: if the clock is correct and the certificate still appears expired, check the server

If synchronization succeeds and the current date in the error is correct, stop adjusting the device clock. Ask the operator to check certificate renewal, service reloads, and whether any server endpoint is still serving an old certificate.

3. Check SNI, server address, and Host separately

SNI is an extension in the TLS ClientHello that indicates the target hostname. In client settings, serverName is commonly used for both the handshake name and certificate hostname verification, depending on the core. It must match the server’s requirements and be covered by a hostname in the certificate’s SANs. “Masking domain” isn’t a standardized protocol field; first confirm whether the provider means SNI, the WebSocket Host, or another transport parameter.

FieldPurposeWhat to check
Server address and portSpecify the server endpoint to connect toMay be a hostname or IP; use the port provided for the node
SNI / serverNameTLS handshake name and, typically, the name used for certificate verificationEnter a hostname only—no scheme, path, or port
WebSocket HostHTTP Host header in the WebSocket handshakeMust match the routing configuration of the reverse proxy or upstream site
WebSocket pathWebSocket request pathKeep the leading slash; a path error usually isn’t a certificate hostname error

A server address can be an IP while SNI is a hostname; this can be a valid setup. For example, you can connect directly to an IP while using a hostname for TLS verification. Conversely, removing SNI may cause the client to verify the certificate against the IP. If the certificate only contains hostnames, this can result in cannot validate certificate ... because it doesn't contain any IP SANs. Don’t assume that a different address and SNI mean the configuration is wrong.

The snippet below illustrates part of a standard TLS configuration. It isn’t a complete, connectable node and doesn’t apply to REALITY. Keep the node’s actual transport type unchanged; the example omits the server address, authentication, and other outbound fields.

{
  "streamSettings": {
    "network": "tcp",
    "security": "tls",
    "tlsSettings": {
      "serverName": "example.com",
      "allowInsecure": false
    }
  }
}

4. allowInsecure: don’t use it to work around certificate problems

Setting allowInsecure to true skips standard server certificate verification. UI options such as “Allow insecure connections” or “Skip certificate verification” usually do the same. TLS encryption may still be in use, but the client can no longer confirm the server’s identity through normal certificate-chain and hostname checks. This isn’t a general-purpose compatibility setting.

Symptom: the connection works after verification is disabled

Cause: The issue may be the certificate’s validity period, hostname match, or trust chain—not network quality. Fix: Re-enable verification and fix the relevant certificate issue. This result doesn’t prove the server’s identity is trustworthy.

Symptom: the handshake still fails after verification is disabled

Cause: The failure may happen before certificate verification—for example, the port isn’t serving TLS, the server rejects the SNI, or the security type is wrong. Fix: Recheck the address, port, and handshake settings. Don’t keep adding insecure options.

5. Fingerprints and REALITY: troubleshoot according to the core in use

A client fingerprint describes TLS handshake characteristics; it isn’t a certificate hostname or a verification bypass. In Xray configurations that support the feature, fingerprint may use values such as chrome. Changing it won’t make an expired certificate valid again or add a missing hostname to the certificate’s SANs.

Configuration typeCheck firstDon’t mix with
Standard TLSDevice clock, serverName, certificate validity, and the full certificate chainDon’t substitute REALITY public key parameters for certificate settings
REALITYserverName, server public key, shortId, fingerprint, and server requirementsDon’t apply the standard TLS approach of disabling certificate verification
Node without TLSFirst confirm whether the error comes from a subscription update, a test target, or a different connectionDon’t enable TLS on the existing node without a reason

v2rayNG uses the Xray core, while v2flyNG uses the V2Fly core; their features and fields aren’t interchangeable. In v2rayN, check which core the current node actually uses. For REALITY or XTLS Vision, first confirm that the selected core supports those features. Being able to import a link doesn’t mean every parameter is supported or active.

6. Diagnose with a TLS handshake tool: port, certificate chain, and server

If OpenSSL is installed, use it to inspect the certificate presented by a standard TLS endpoint. In the command below, example.com is a format example; replace it with the actual endpoint and the SNI required by the server. Use the node’s configured port as well. This test checks only the TLS layer; it doesn’t verify VMess or VLESS authentication.

openssl s_client -connect example.com:443 -servername example.com -showcerts -verify_hostname example.com -verify_return_error
443
Example TLS endpoint port; not a fixed value for every node
TLS 1.2
A commonly negotiated version, if supported by both sides
TLS 1.3
Another commonly negotiated version; not a fingerprint name

Bottom line: a successful tool test confirms only that particular TLS check

If certificate verification succeeds but the proxy still fails, check the transport path, authentication parameters, and server inbound configuration. Don’t keep changing SNI once it’s verified, and don’t assume every post-handshake failure is a certificate issue.

7. Verify the fix and answers to common questions

After each change, save the node and establish a new connection; existing long-lived connections may not pick up new settings right away. Verify in this order: the core starts correctly → the node handshake succeeds → a real request works. If the client logs no longer show certificate errors but the browser still has problems, check the system proxy, the app’s proxy settings, and routing rules. Don’t expand the investigation back to every TLS setting.

  1. Confirm automatic time synchronization succeeded and the date remains correct after restarting the device.
  2. Confirm SNI matches the server’s requirements, certificate verification is enabled, and the transport Host and path haven’t been changed accidentally.
  3. Select the repaired node, run one real connection test, then use an app with the proxy configured correctly to access an actual destination.
  4. Record the fields changed and the result. If the configuration came from a subscription, ask the provider to fix the source data so the next update doesn’t overwrite your local changes.
A certificate error during a subscription update—does that mean the node’s SNI is wrong?

Not necessarily. A subscription update is an HTTPS request from the client to the subscription URL. It verifies the subscription site’s certificate and usually doesn’t use the SNI in the node editor. First determine whether the error occurred during “Update subscription” or “Connect to node,” then check the relevant hostname, system clock, and trust chain.

If the same node works on another device, does that rule out a server problem?

Not completely. The devices may resolve to different endpoints or use different trust stores, cores, or clock settings. Compare the actual server address, SNI, certificate issuer, and expiration date first, then compare settings one at a time. Don’t copy all system settings wholesale.

Why does the client still fail if the masking domain opens in a browser?

The browser may connect to a different address, use a different trust store, or take a different transport path. Loading the page only proves that one browser request succeeded. The client still needs to connect using the address, port, SNI, transport settings, and authentication parameters specified for the node.

Download clients