Shadowrocket Trojan Setup: Password, SNI, and TLS Certificate Checks

Learn how Trojan uses TLS to resemble HTTPS, how to enter the address, port, password, SNI, and certificate settings in Shadowrocket, and what commonly causes handshake failures.

At a glance

When adding a Trojan server manually, enter the connection address, port, Password, and SNI according to the service details, and keep TLS certificate verification enabled. If you see a timeout, certificate error, or pages fail to load after connecting, identify the failing stage before changing the relevant field. Don’t change the port, SNI, and Password all at once.

Trojan TLS Handshake and Password Authentication

A standard Trojan connection first establishes a TCP connection, then performs a TLS handshake, and finally sends Trojan authentication and proxy requests through the encrypted channel. Trojan is designed to make the connection look like a typical HTTPS TLS handshake, but the data carried inside TLS is Trojan traffic, not a regular web request. Being able to open a website with the same name in a browser doesn’t confirm that Shadowrocket’s port, transport settings, or Password are correct.

Enter Each Field in Add Server

First, open the Trojan settings provided by your service. If the details also specify a transport type or additional fields, check them against the same set of instructions. Don’t combine parameters from different entries. The steps below apply to manual setup.

  1. Choose the protocol

    Open the add-server screen via Home → + → Add Server, then select Trojan under Type. When editing an existing entry, check Type first, then review the other fields.

  2. Enter the address and port

    Enter the hostname or IP provided by the service in Address, and the numeric port separately in Port. For example, if the details show edge.example.com:443, split it into edge.example.com and 443. Don’t add https://, a port, or a path to Address.

  3. Enter Password

    Enter the Trojan Password exactly as provided, preserving capitalization and punctuation. When pasting, check for an extra line break or field label. If you only have a complete import link, don’t paste it into Password or guess which characters to keep. Use the import option or refer to the service’s individual field values.

  4. Check SNI

    Enter the provided SNI in the TLS settings. Enter the hostname only, without a port or path. If Address is an IP and the details list a separate SNI domain, keep the IP in Address and enter the domain separately in SNI. If no SNI is listed, first check whether the service expects the domain in Address to be used; don’t copy a hostname from a different entry.

  5. Save and select the entry

    Keep TLS certificate verification enabled. After saving, return to Home, select the entry you just added, and turn on the connection switch. To check whether a particular webpage is actually using that entry, also review Global Routing; turning on the connection switch doesn’t route every request through the proxy.

TLS Certificate Verification Settings

If the interface has an Allow Insecure option, it controls whether certificate verification is skipped, not whether TLS is enabled. Skipping verification may still encrypt data with TLS, but removes the protection of using the certificate to confirm the server’s identity. So enabling Allow Insecure is not a fix for certificate errors.

Keep certificate verification enabled

Recommended

Leave Allow Insecure off. If you see a name mismatch, expired certificate, or untrusted certificate warning, check SNI, the device’s date and time, and the server certificate, respectively.

Best for: everyday connections, initial setup, and certificate troubleshooting

Skip certificate verification

Turning on Allow Insecure may suppress certificate errors, but it doesn’t confirm that you’re connecting to the intended service or fix an incorrect port or Password.

Best for: understanding what the setting does; not for everyday use or troubleshooting

Bottom line: address certificate errors based on their type

For a name mismatch, compare the current entry’s SNI with the service details character by character. If they match, or the warning says the certificate is untrusted, ask the service provider to check the certificate and chain actually returned at that address and port, without weakening verification.

Pinpoint the Failure Stage When a Connection Fails

Start with the exact message shown. A timeout or dropped connection alone doesn’t prove the Password is wrong. Likewise, seeing the connection switch enabled on Home doesn’t mean a proxy request to a particular site succeeded. Keep the same entry and test destination throughout troubleshooting, and change only one setting at a time.

What you seeCheck first
Domain name resolution failedCheck whether Address accidentally includes a port, path, or spaces, and confirm that the current network can resolve the domain. Don’t replace the connection address with a separately listed SNI.
Connection timed out or refusedCheck that Address and Port belong to the same service entry. Keep the settings unchanged and test again on another known-working network. If it still fails, ask the service provider to confirm that the port is listening.
Certificate name, validity, or trust errorCheck SNI, the device’s date and time, or the certificate chain according to the error. Even on 443, the connection may reach a service that returns a different certificate.
TLS handshake confirmed, then connection droppedRecheck Type, Password, and the transport settings required by the service. A disconnection with no further details isn’t enough to conclude that authentication failed.
Only some sites have connection issuesCheck Home → Global Routing. Direct bypasses the proxy; under Config, rules in the configuration determine how requests are handled. First confirm that the test request actually goes through the Trojan entry.

Trojan Setup FAQ

Can Address and SNI use the same domain?

Yes, provided the service details specify that domain as both the connection address and TLS name, and the server certificate covers it. If the details list them separately, enter each as given. Don’t change either value just to make them match.

The details specify port 8443. Should I change it to 443?

No. Enter 8443 in Port and only the hostname or IP in Address. Using TLS and using 443 are separate things. Changing the port connects to a different listening endpoint, which may run another service.

A certificate error appeared after updating the subscription. Should I re-enter the password?

Don’t change Password yet. On Home, confirm that the updated entry is selected, then compare Address, Port, and SNI with the original service details. If the fields match and the device time is correct, copy the exact certificate error and ask the service provider to investigate. Don’t include your Password or the full subscription link in the error report.

How can I check whether a test webpage is using Trojan?

On Home, make sure the intended entry is selected and note the current Global Routing setting. You can briefly switch to Proxy, test the same webpage, then restore the original setting. If it works under Proxy but not Config, first check which rule matches the request; don’t start by changing SNI or Password.

Download Shadowrocket