Shadowrocket Trojan Setup: Password, SNI, TLS, and Allow Insecure

Learn how Trojan works and what each field means in Shadowrocket’s Add Server screen, including common setup mistakes. All examples use fictitious values.

At a glance

This guide is for readers who have received Trojan settings from their own service provider or administrator and want to add a server manually in Shadowrocket on iPhone or iPad. Enter Address, Port, and Password exactly as provided, and set SNI as required by the server. Keep Allow Insecure off for everyday use. If the connection fails, check the address and port first, then the TLS certificate, and finally the password and routing.

01 How Trojan connections work

Trojan first establishes a TLS connection, then sends an authentication value derived from Password along with the proxy request through the encrypted channel. TLS protects the connection and uses certificate verification to confirm the server’s identity. Password lets the server check whether the client is authorized to use the service. A correct password cannot compensate for a certificate verification failure, and a valid certificate does not mean the password is correct.

443
Common TLS ports; use the port specified by the server
2 stages
Establish TLS first, then authenticate with Trojan
0 port suffixes
Enter only the hostname in SNI; enter the port separately in Port

Bottom line: check TLS first if certificate errors appear

If the connection reports a certificate name mismatch, compare SNI with the name covered by the certificate in the server settings before changing Password. If the connection fails during certificate verification, Trojan authentication has not started yet.

02 Enter Trojan settings in Add Server

These steps start from Home on iPhone or iPad. Before adding a server manually, have the server address, port, Trojan password, and TLS hostname specified by the server ready. If you only have a subscription URL, import your own subscription instead of splitting it up and entering its details in the manual form.

  1. Choose the protocol

    On Home, tap “+” in the upper-right corner to open Add Server, then open Type and select Trojan. Check Type before entering the other fields; Password does not necessarily serve the same purpose across different protocols.

  2. Enter the address and port

    Enter the server-provided domain name or IP address in Address, and enter the port number separately in Port. For example, if your settings list edge.example.com and 8443 separately, enter them in their respective fields. Don’t add https://, a path, or :8443 to Address, and don’t change a nonstandard port to 443 on your own.

  3. Paste the password

    Enter the Trojan password for that server in Password. This is not your provider account password or a token from a subscription link. After pasting, check for any extra explanatory text, quotation marks, or line breaks. Preserve the password’s capitalization and symbols.

  4. Check TLS settings

    Trojan uses TLS. If the form has a TLS switch, leave it on. If the server provides an SNI value, enter the hostname exactly as given, such as tls.example.com, without a protocol prefix or port. If no SNI is provided, don’t guess; if Address is an IP address, in particular, confirm the required TLS hostname with the server first. Keep Allow Insecure off.

  5. Save and test the connection

    Tap Done to save, return to Home, select the server you just added, and turn on the connection switch. Turning it on only indicates that the local tunnel has started; it doesn’t prove that a particular request went through this Trojan connection. When testing, also check whether Global Routing sends the target request through the selected server.

The domain name and port above illustrate field formats only; they do not correspond to a working service. When entering settings manually, use the complete set from the same server profile to avoid combining an address from one record with a password from another.

03 How Address, SNI, and certificate names relate

Address determines where the client connects; if it’s a domain name, the client must resolve it first. SNI is the hostname the client sends during the TLS handshake, which the server can use to select a certificate. The two can match or differ. For example, server settings might specify a connection to 192.0.2.10 while requiring tls.example.com as the TLS hostname. In this case, swapping the domain name and IP address is not equivalent.

Server-provided settingsWhat to enterWhat to check
The connection domain is also the TLS hostnameEnter edge.example.com in Address; if SNI is explicitly required, enter the same hostname there.The certificate should cover this hostname. If the settings allow SNI to be left blank, there’s no need to enter a different domain name.
The connection domain and TLS hostname differEnter edge.example.com in Address and tls.example.com in SNI.Keep each value as provided. Don’t make them match just because both fields accept domain names.
The connection address is an IP; a separate TLS hostname is providedEnter 192.0.2.10 in Address and tls.example.com in SNI.Use the IP to connect and the domain name for TLS. Don’t copy the IP into SNI.

A matching name is only one part of certificate verification. An expired certificate, a missing intermediate certificate on the server, or a significantly incorrect device clock can also cause verification to fail. If the same settings worked before, check the device’s date and time first, then ask the administrator to check the certificate’s validity and chain. There’s no need to keep pasting the password again.

04 How to set Allow Insecure

Allow Insecure controls whether TLS certificate verification can be skipped; it does not turn TLS on or off. Even if the connection remains encrypted with TLS when this setting is enabled, the client can no longer rely on normal certificate checks to confirm that the other end is the intended server.

Allow Insecure off

Recommended

Certificate verification stays enabled. If you see a name, validity, or trust-chain error, note the error and check the configuration or ask the administrator to fix the server certificate.

Best for: everyday use and verifying corrected TLS settings.

Allow Insecure on

Skips certificate verification, which may allow a connection that should have been rejected to continue. It does not fix the certificate or resolve a wrong port or incorrect Trojan password.

Best for: administrators comparing certificate verification results with test credentials in an isolated environment—not for everyday connections.

05 Common Trojan connection problems

The connection times out immediately. Should I re-enter the password first?

Don’t change the password yet. On Home, open the server entry and check that Address has no protocol prefix or path and that Port matches the value provided by the server. If the same settings work on mobile data but time out on the current Wi-Fi network, note the network and time for both tests and first check whether the current network can reach that address and port. A timeout alone doesn’t prove the password is wrong.

I get a certificate name mismatch. What should I enter for SNI?

Enter the TLS hostname specified by the server, without any accidentally pasted prefix, port, or path. If Address is an IP or a connection domain, don’t assume it should also be used for SNI. If the value matches the settings but the error persists, ask the administrator to confirm that the certificate actually returned by that address and port covers the hostname.

There’s no certificate error, but the request still disconnects. What should I check?

No certificate error doesn’t mean TLS or Trojan authentication completed. First confirm that Type is Trojan and that the port corresponds to the Trojan service, then check with the server settings to see whether Password has changed. If the settings specify other transport parameters, don’t apply values from another record. If the cause is still unclear, give the administrator the test time and error details to compare with server logs; don’t include the password.

The Home switch is on. Why won’t the target website load?

First confirm that Home has the newly added server selected, then check Global Routing. In Direct mode, web requests won’t use this proxy. In Config mode, check which policy the current Config assigns to the target address. If you’ve confirmed that the target is going through the selected proxy, check whether the target itself is reachable. One failed website doesn’t prove the password is wrong.

Get Shadowrocket and browse the guides

The iPhone and iPad version is a one-time $2.99 purchase on the App Store; check the App Store listing for system requirements. The Mac (Apple silicon and Intel), Windows, Android, and Linux versions are free. On this site, choose your platform on the app download page. For help with your first connection, continue to the setup guide.

Download Shadowrocket