V2Ray TLS Certificate Errors: Fix System Clock and SNI Issues

V2Ray TLS handshake and certificate errors often come down to an incorrect system clock or an SNI name that doesn’t match the certificate. Check these in order to find the cause.

At a glance

For readers troubleshooting connection failures in v2rayN, v2rayNG, or v2flyNG, especially when the logs show x509. First identify which connection failed, then use the log to distinguish certificate validity dates, hostname mismatches, and certificate chain issues. Change one setting at a time, keep certificate verification enabled, and retest with the same node.

Check the logs first: certificate error or ordinary timeout?

Select the affected node in the v2rayN main window, note when you tried to connect, then check the matching entries in the log panel at the bottom. The initial error may only say the connection failed; the useful detail usually follows and starts with x509:. If the error occurs only while updating a subscription, check whether it relates to an HTTPS request to the subscription site. The subscription URL and the node’s outbound connection are separate; changing the node’s SNI won’t fix the subscription site’s certificate.

x509: certificate has expired or is not yet valid

Cause: The time used for verification falls outside the certificate’s validity period. Fix: Sync the device clock first, then check whether the certificate currently served by the remote endpoint is actually expired or not yet valid.

x509: certificate is valid for

Cause: The log usually lists the names covered by the certificate and the name being verified for this request. They don’t match. Fix: Check the TLS hostname provided by your service operator, then verify the SNI and destination endpoint. Don’t substitute another hostname just because it appears in the error.

x509: certificate signed by unknown authority

Cause: The client can’t validate the received certificate chain back to a trusted root. Fix: Ask the service operator to check that the required intermediate certificates are being sent. If an internal CA is used, follow your organization’s official process to check the device’s trust settings.

Seeing only i/o timeout, connection refused, or EOF doesn’t prove the problem is certificate-related. A timeout can happen before the connection is established or during the handshake. First check that the address, port, and transport settings match the details from your service operator. For example, if the endpoint specifies 8443, don’t switch to 443 just because TLS is enabled.

System clock issues: distinguish device time from certificate validity

Certificate verification uses the actual time, not just the hour shown on your desktop. In logs, Z means UTC and +08:00 means eight hours ahead of UTC. For example, 2026-10-09T01:00:00Z and 2026-10-09T09:00:00+08:00 represent the same moment, so they don’t mean the device clock is eight hours fast. Conversely, manually setting the displayed time correctly while choosing the wrong time zone can still leave the actual time out of sync.

  1. Check for a clock mismatch

    Keep the latest failed log entry. If it includes current time, is after, or is before, convert both timestamps to the same time zone before comparing them. Don’t compare a UTC timestamp in the log directly with the local clock.

  2. Sync the device clock

    In Windows 11, open Settings → Time & language → Date & time. Check the time zone, turn on Set time automatically, then select Sync now under Additional settings. If syncing fails, first make sure the device can sync its system clock. On managed devices, follow your administrator’s time service settings.

  3. Retry the same node

    Keep the SNI and port unchanged, then reconnect using the same node and check the log under the new timestamp. If syncing the clock clears the error, there’s no need to change the node configuration.

  4. Check the certificate’s validity period

    Suppose the device’s actual time is 01:00Z and the certificate becomes valid at 00:55Z that same day. If the device clock is 10 minutes slow, it reads 00:50Z and incorrectly treats the certificate as not yet valid. If the certificate still clearly appears expired after syncing, give the timestamp and error to the service operator to investigate. Don’t turn back the clock to keep connecting.

Setting SNI: distinguish the connection address, certificate hostname, and transport fields

SNI is the server name a client sends during the TLS handshake. It lets multiple sites sharing an endpoint select the right certificate. In common V2Ray or Xray TLS node configurations, an explicitly set serverName is also typically the name the client verifies against the certificate. Use the steps below to check each item in order. Certificate verification succeeds only when both the certificate name and trust chain are valid.

Endpoint addressHandshake hostnameServer certificateName and chain verificationApplication data
FieldExample valueWhat to check
Address and port192.0.2.40:443These determine which endpoint the client connects to. Use the values provided by your service operator.
SNI / serverNameedge.example.comEnter a hostname without https://, a port, or a path. The certificate’s SAN must cover the name being verified.
WebSocket Host and pathedge.example.com、/relayThese belong to the HTTP request layer. Even if Host happens to match SNI, changing Host does not change the TLS field.

In the v2rayN main window, double-click the target node in the server list. In the edit window, find the SNI or server name field in the TLS section; the label may vary between versions. Enter only a hostname confirmed by your service operator, save, then select the node again to test. If the address is an IP and no verification hostname is explicitly set, the client may verify the IP. In that case, the certificate must include the corresponding IP entry in its SAN; a regular hostname entry won’t suffice. The address and hostnames in the table are examples to illustrate the difference between fields.

If SNI is correct but the wrong certificate arrives, check the endpoint first

For example, if the log says the client should verify edge.example.com but the certificate only covers default.example.com, don’t change the SNI to the default site’s name just to dismiss the warning. Check the address and port first, then ask the service operator to verify that the endpoint is configured with a certificate for edge.example.com.

Retest after changes: identify where the error occurs

Keep certificate verification enabled for every retest. Make one real request using the same node and record the new log. If you change the address, port, and SNI all at once, even a successful request won’t tell you which setting caused the original failure.

Common questions: one device failing, wildcard certificates, and subscription overrides

Why does the same node work on my computer but show a certificate error on Android?

First confirm both devices are using the same actual configuration. On Android, search Settings for “Date & time,” turn on automatic time, and check the time zone. If the error persists, compare the current time and verification hostname in both logs. Don’t assume the configurations match just because the nodes have the same label.

Why doesn’t the certificate match when it covers *.example.com?

This wildcard covers one subdomain level, such as edge.example.com. It doesn’t cover example.com or a.edge.example.com. Compare the hostname the client tried to verify in the log with the certificate SAN, and confirm that the name assigned by your service operator is within the certificate’s coverage.

Why did updating the subscription restore the old SNI after I changed it manually?

Compare the same entry before and after the update. If the address and port are unchanged but the subscription overwrites SNI, the correction needs to be made at the subscription source rather than manually after every update. When reporting the issue, include when it occurred, the client and core versions, and the exact error. Don’t share subscription URLs, access tokens, or node credentials.

Can I leave “Allow insecure connections” enabled if that fixes it?

Not recommended. Skipping certificate verification prevents the client from reliably confirming the server’s identity, and a working connection doesn’t mean the certificate issue is fixed. Keep verification enabled and use the logs to investigate the time, hostname, or trust chain. If there isn’t enough information, ask the service operator to confirm the endpoint and certificate configuration.

Client downloads