This guide uses Shadowrocket on iPhone and iPad as an example. It’s for users who already have Trojan settings and need to add them manually or check an imported configuration. First, make sure Address and Port point to the right server, then check SNI and the server certificate. Password is used for Trojan authentication; it cannot fix a TLS error. Keep certificate verification enabled and troubleshoot based on where the connection fails.
How a Trojan connection works: TCP, TLS, authentication
A standard Trojan connection first establishes a TCP connection to the destination specified by Address and Port, then performs a TLS handshake. If SNI is configured, the client tells the server which hostname it wants during the handshake so the server can select the appropriate TLS settings and certificate. The client must still verify that the certificate is trusted, within its validity period, and matches the expected hostname. Only after the handshake does Trojan send authentication data derived from Password through the encrypted connection.
Bottom line: check SNI first if the certificate name doesn’t match
If you only changed Address, for example by replacing a domain with an IP address, compare it with the original configuration and check whether SNI still specifies the original certificate hostname. Don’t re-enter the password or enable Allow Insecure.
Enter Trojan settings in Add Server
Open the configuration details and identify the server address, port, and Trojan password. Then check whether a separate SNI value is provided. Don’t paste a subscription URL, service account password, or full node link into a field without first identifying what it contains. Keep the original entry before adding settings manually so you can compare or revert.
Select the type
Open
Home, tap the “+” in the top-right corner to openAdd Server, then chooseTrojanunderType. Select the type before entering settings to avoid saving fields with the same names under a different protocol.Separate the address and port
Enter the server’s domain name or IP address in
Address, and the port number provided by the service inPort. For example, if the instructions sayedge.example.com:8443, enteredge.example.comand8443in their respective fields. Don’t paste both intoAddressor change a specified port to443.Check the password
Enter the original Trojan password in
Password, preserving uppercase and lowercase letters and any symbols it contains. Don’t include the field label, surrounding quotation marks, or extra line breaks. If you have a full node link, import it first and then check the fields: text such as%40in a link may be URL-encoded and shouldn’t be entered as part of a manually typed password.Enter SNI
If the original configuration provides a separate
SNIvalue, enter that hostname in the corresponding field. Don’t replace it withAddressor addhttps://. If no SNI value is provided, leave the field at its default setting for now. Don’t use the domain in a subscription URL or the website you plan to visit.Save and test
Leave
Allow Insecureoff. After saving, return toHomeand select the entry you just added. Connect, then test a known-reachable destination that should use the proxy. If you runConnectivity TestfromHome, make sure it tests the same entry; results from another node won’t tell you whether this configuration works.
Difference between Address and SNI
Address determines where the connection goes; SNI provides the hostname requested during the TLS handshake. They can be the same or different. The examples below explain how to read a configuration; the domain names and IP addresses shown are for documentation only and cannot be used to connect.
| Existing configuration | Address | SNI |
|---|---|---|
| Server uses a domain name, with no separate SNI value | edge.example.com | Keep the default setting; don’t enter another hostname |
| Server uses an IP address and provides a certificate hostname | 192.0.2.24 | edge.example.com |
| The server address and specified TLS hostname differ | edge.example.com | tls.example.com |
A service sharing an IP address may return different certificates based on SNI. So even with the correct IP and port, a missing or incorrect SNI can result in a certificate whose name doesn’t match. Conversely, the correct SNI won’t redirect the connection to another IP address. If the existing configuration gives only an IP address and hostname verification fails, ask the source of the configuration to confirm the expected certificate name rather than choosing one from the error message.
Troubleshooting Allow Insecure and connection errors
Allow Insecure affects TLS certificate verification; it does not turn TLS encryption on or off. Even if the connection remains encrypted, enabling this option prevents the client from confirming through normal checks that the remote server is the one you expect. It cannot fix the port, provide a missing server certificate chain, or correct the password. Keep it off for regular use. If an error appears only when certificate verification is enabled, fix the certificate or configuration rather than saving a setting that skips verification.
- Domain name resolution fails or the connection times out: First check whether
Addressincludes a path or port, then confirm thatPortmatches the original configuration. A timeout alone doesn’t indicate a wrong password, nor does it necessarily tell you whether the current network is unreachable or the server isn’t responding. - Certificate name, validity, or trust error: Compare
SNIcharacter by character with the original configuration, and check that the device’s date and time are correct. If the name matches but the certificate is still reported as expired or untrusted, note the error type and ask the source of the configuration to check the certificate and chain. - The TLS handshake completes, but the connection closes immediately: Check the selected
Type, the service on that port, andPassword. A closed connection alone doesn’t prove the password is wrong. Compare with the original entry, change one setting at a time, and test again. When recording the error, don’t include the password, full node link, or subscription URL.
Common questions about Trojan settings
Does the port have to be 443?
No. 443 is common, but Trojan doesn’t require it. If the instructions specify 8443, enter 8443 in Port. If no port is given, check the original configuration instead of guessing based on the domain name.
There’s already an entry with the same name in my subscription. Do I still need to add one manually?
Find the imported entry in Home and open its details to check Type, address, port, and SNI. Entries with the same name don’t necessarily have the same settings. If you need to test manually entered values, create a clearly distinguishable entry and keep the subscription entry to avoid mixing them up after a refresh.
The connection is on. Why isn’t my traffic using this entry?
First, confirm in Home that the selected entry is the Trojan one you want to test, then check Global Routing. If it’s set to Direct, traffic goes directly to its destination. If it’s set to Config, open Config and check which configuration is active, then confirm that the rule matching your destination routes it through the proxy. Turning the connection on only means the system tunnel is enabled; it doesn’t prove that this destination is using Trojan.