How to Set Up a Trojan Server in Shadowrocket: Password, SNI, TLS, and Allow Insecure

Learn how Trojan uses TLS, then follow the Add Server fields for Address, Port, Password, and SNI. Understand the risks of Allow Insecure.

At a glance

This guide is for users who already have Trojan parameters or a subscription from their own provider and want to check a manual setup. Verify Address, Port, Password, and SNI in order, then distinguish the TLS handshake, authentication, and rule-based routing stages. If you encounter a certificate error, correct the domain, certificate chain, or device time rather than treating Allow Insecure as a routine fix. The steps use the iPhone / iPad interface.

How Trojan connects: TLS first, then authentication

Trojan in Shadowrocket is a proxy protocol type, not a subscription name or routing mode. A standard Trojan connection first opens a TCP connection to the specified server and port, completes a TLS handshake, then sends authentication details and the destination request through the encrypted channel. Choosing the wrong protocol type means matching-looking addresses and passwords do not make the settings compatible.

TLS provides encryption in transit and verifies the server's identity; Password authenticates access to the Trojan server. These are separate functions. A valid certificate does not mean the password is correct, and a correct password does not replace certificate verification. A connection can fail during DNS resolution, TCP connection, TLS handshake, Trojan authentication, or while reaching the destination site, so identify the stage before troubleshooting.

443
Examples of commonly used TLS ports; use the port specified by your provider
1–65535
The valid numeric range for Port does not mean a service is available on every port
3 stages
TCP connection → TLS handshake → Trojan authentication and request

Identify the stage, then change one field

For a certificate error, first check SNI, the certificate's validity period, and the device time. For a connection timeout, check Address, Port, and network reachability. Don't change the password, port, and certificate verification settings all at once, or you won't know which change made a difference.

Add Server fields: what to enter for Address, Password, and SNI

Tap “+” in the upper-right corner of Home to open Add Server. Set Type to Trojan, then fill in the remaining fields. Get parameters and subscriptions from your provider. The domain and password examples in this guide are for illustration only; they do not identify a working service and cannot be used to connect.

FieldWhat to enterCommon mistake
TypeSelect TrojanGuessing the protocol from its name and choosing a different type
AddressThe server domain or IP provided by your provider, such as edge.example.comPasting a full web address, path, or subscription link
PortThe integer specified by your provider, such as 443Assuming every Trojan service uses 443
PasswordThe Trojan authentication password for that server, entered exactly as providedUsing an account login password or copying extra spaces or line breaks
SNIThe TLS service name specified by your provider, usually a domain, such as tls.example.comEntering a URL, port, or an unverified domain
Allow InsecureLeave off for normal useLeaving certificate verification disabled to make an error go away

Address specifies where to connect. SNI tells the server which name to use during the TLS handshake and can determine the certificate and virtual host presented. The two values may be the same or may differ if your provider specifies it. For example, Address can be the server IP while SNI is a domain covered by the certificate. Don't swap them arbitrarily.

Password is usually case-sensitive. When entering it manually, watch for leading or trailing spaces, full-width characters, and line breaks. Don't hash the password yourself or treat an encoded segment from an export link as a plaintext password. If you already have a complete configuration, keep the imported entry and compare its fields with the original details from your provider.

Add a server and verify it: five steps

These steps cover basic setup for standard Trojan only. If your provider also requires WebSocket, a specific path, or other transport settings, configure the complete set of parameters; don't omit them based on the name “Trojan” alone. If you already have a subscription entry, keep it so you can compare settings while troubleshooting.

  1. Choose the type

    Home → “+” in the upper-right corner → Add Server → Type → Trojan. Make sure you're editing a server, not adding a routing rule in Config.

  2. Enter connection details

    Enter Address, Port, and Password as provided. Put only a hostname or IP in Address and enter Port separately; don't append a web path to the address.

  3. Check TLS

    Check SNI in the TLS settings and leave Allow Insecure off. SNI must not include https://, a slash, or a port. If you're unsure, confirm the requirement with your provider instead of guessing.

  4. Save and select

    After saving, return to Home and tap the circle to the left of the server to make it the current default. If a policy group in your configuration explicitly selects another server, changing the default selection may not change that group's route.

  5. Verify the connection

    Turn on the connection switch and allow the VPN configuration when prompted by the system. Run Connectivity Test from Home, then visit the site you want to test. Note whether the result is a timeout, a certificate error, or a failure affecting only specific sites.

Interpret Connectivity Test results in context: the latency value reflects only the probe target and method used; it does not prove that every destination site or transport type is available. A connection switch that remains on also doesn't mean Trojan authentication succeeded. Consider the interface status, diagnostic results, and actual browsing behavior together.

If On Demand is enabled, temporarily disable its triggers in Settings → On Demand while troubleshooting, then reproduce the issue with the manual switch. Restore the original settings after testing. This prevents network changes from triggering automatic connections or disconnections and affecting your test results.

TLS and Allow Insecure: what to do about certificate errors

For standard Trojan, TLS is an essential part of the connection. Don't switch to an unencrypted connection to work around a certificate error. Proper certificate verification checks whether the certificate is trusted, matches the name, and is within its validity period; this is not the same as merely checking whether the connection is encrypted.

Allow Insecure relaxes or skips server certificate verification; it's not a routine “compatibility” setting. TLS may still encrypt traffic when this option is enabled, but verifying the remote server's identity is weakened, increasing the risk of interception by an impersonating endpoint. It won't fix a wrong password, a closed port, or an unavailable server.

Connected but can't browse: distinguish protocol issues from routing issues

Successfully saving the settings only means the input was accepted; it doesn't mean the remote server accepted authentication. If TCP connects but TLS fails, focus on the certificate and SNI. If the connection drops immediately after TLS succeeds, the cause may involve the password, protocol, or server policy. Check the logs rather than assuming a single symptom proves the password is wrong.

If some sites load while others don't, check Home → Global Routing. Proxy, Direct, Config, and Scene are different routing modes, not four Trojan encryption methods. Requests in Direct may bypass the current server. Config routes requests according to its rules and policies; troubleshoot Scene using its current settings.

Observed symptomCheck firstNext step
Repeated connection timeoutsAddress, Port, DNS, and network reachabilityVerify the settings and retest on another network you can control; don't disable certificate verification first
Explicit certificate errorSNI, device time, certificate validity, and certificate chainKeep the error details and ask your provider to check the TLS configuration
Disconnects immediately after the handshakePassword, Type, and additional transport requirementsCompare the exact original parameters and check the server logs
Only some sites failGlobal Routing, matching rules in Config, and policiesConfirm which route the failed request actually used, then check the destination site and DNS

With Config, rules such as DOMAIN-SUFFIX, GEOIP, IP-CIDR, and FINAL determine how a request is routed next; they don't change Trojan's password or certificate. If a rule points to a policy group, also check which server is currently selected in that group. Don't rewrite the entire Config while troubleshooting a TLS error, or you'll conflate connection and routing issues.

Compare before and after using the same request

Keep the server and test site unchanged. Change only one field you've confirmed is incorrect, then repeat the connection and access tests. If you temporarily switch to Proxy to rule out routing effects, note the original Global Routing setting and restore it after testing so other requests aren't affected long-term.

Common setup questions: blank SNI, subscription updates, and password security

Can I leave SNI blank?

Start with the complete settings from your provider. If Address is a domain and no SNI is specified, the client may use the connection domain as the TLS name; this isn't true for every server setup. If Address is an IP or your provider gave you a separate TLS domain, don't assume leaving SNI blank is correct. Confirm the required SNI.

Why does it still time out on port 443?

443 is a common port, not a fixed port for Trojan. Edit the entry from Home, verify Address and Port against your provider's details, and check whether your current network can reach that endpoint. Entering 443 won't redirect traffic if the service listens on a different port.

Why did my manual changes disappear after a subscription update?

Subscription entries may be regenerated from remote content when refreshed. For a lasting SNI or password correction, confirm it with your provider and have the subscription source updated. For a temporary comparison, create a separate manual entry instead of repeatedly changing subscription-managed settings. Don't share the full subscription URL when comparing settings before and after an update.

What information should I include when asking for help?

Include Type, the stage where the error occurred, the error text, the Global Routing mode, and whether SNI matches your provider's instructions. Hide Password, subscription tokens, and other credentials. Before sharing a screenshot, check that QR codes, notes, and logs don't contain sensitive information. If your provider needs to identify your account, contact them through their official support channel.

Keep a record of the settings and where they came from: store the server address, port, TLS name, and additional transport requirements separately, and use an appropriate credential manager for the password. This guide assumes you already have a provider and subscription. This site does not provide, sell, or recommend servers, subscriptions, or routes. A one-time app purchase does not include a service plan, and installing the app doesn't automatically create a working server.

Download Shadowrocket