When setting up Trojan, first check Type, Address, Port, and Password, then enter SNI as specified in your existing configuration. In most cases, leave Allow Insecure off. For users who already have their own provider’s settings or subscription, this guide covers the fields and troubleshooting in order: establish the connection, verify the certificate, authenticate the protocol, and check routing. Example values illustrate the format only and cannot be used to connect.
Trojan connections use TLS before authentication
In Shadowrocket, Trojan is a proxy protocol type, not a service you can use by entering a password alone. The client needs the server address, port, and Password accepted by the server. Buying the client and obtaining a connection service are separate matters. This guide assumes you already have your own provider and subscription; this site does not provide, sell, or recommend servers or subscriptions.
A typical Trojan connection first establishes a connection to the destination address, then performs a TLS handshake. The TLS stage involves verifying the server certificate and its name. Once the channel is established, the client sends Trojan authentication information and the destination request. So a correct Password cannot fix a certificate name mismatch, and changing SNI cannot fix an incorrect Password.
- Connection target: Address and Port determine the server endpoint the client connects to. A domain name usually needs to be resolved through DNS first.
- TLS handshake: SNI specifies the server name during the handshake. The client also verifies the certificate chain and the name on the certificate according to its configuration.
- Trojan authentication: Password must match the credentials accepted by the server. A subscription URL token or a field from another protocol cannot be used instead.
- Request routing: After authentication, whether a request uses this server also depends on Global Routing, the active configuration, and the selected policy.
These four steps are a troubleshooting sequence, not four independent switches. Resolve each stage before diagnosing the next. A latency test returning a result only shows that the parts covered by that test responded; it does not prove that the certificate, authentication, or every destination request is working.
Add Server: Enter Each Field
To add a server manually, tap “+” in the upper-right corner of Home, open Add Server, and set Type to Trojan. Do not choose another Type just because it also uses port 443; the port number does not identify the protocol. The steps below assume you already have a complete set of Trojan settings. Field labels may vary with the current in-app interface.
-
Open the Add Server screen
Go to Home → “+” in the upper-right corner → Add Server, then select Trojan for Type. If you are editing an existing entry, note its current values first so you do not overwrite a working configuration.
-
Enter the server endpoint
Enter the server hostname from your existing settings in Address, and the port number in Port. For example, set Address to
edge.example.comand Port to443. Do not combine them into one address. -
Enter the credentials
Copy the full Trojan Password into the corresponding field, checking capitalization and any leading or trailing spaces. Do not add a field name, quotation marks, or line breaks, and do not enter a subscription URL.
-
Check TLS settings
Enter SNI as specified in your existing settings, and check Allow Insecure. If your settings specify an SNI, use it exactly as provided; do not enter a popular website’s domain by guesswork. For a properly configured certificate, leave Allow Insecure off.
-
Save and test
After saving, return to Home, select the entry you just added, and check Global Routing before connecting. If iOS prompts you to authorize a VPN configuration on the first connection, follow the system prompt, then test an actual request.
Enter only a hostname or IP address in Address, without https://, a path, or query parameters. Port must match the server settings you already have. While 443 is common, TLS services may use other ports, such as 8443; do not change the port to 443 without confirmation. If the supplied settings include transport or other advanced options, match each one as well. The four basic fields alone are not enough to infer a complete configuration.
Password and SNI: Two Different Settings
Password is the Trojan authentication credential; SNI is the server name used during the TLS stage. They serve different purposes and use different formats. A Trojan Password does not have to be a UUID. Even if a credential looks like a UUID, treat it as a complete password; do not split or rewrite it based on VMess or VLESS field conventions.
Connection and authentication example
- Type
- Trojan
- Address
edge.example.com- Port
443- Password
DemoOnly-7qK9-p4
These are sample values, not settings for a working service. Replace Password with the complete credential you already have.
TLS name example
- SNI
tls.example.com- Certificate name
- Should cover
tls.example.com - Allow Insecure
- Off
- Name format
- Hostname only, without a protocol, path, or port
SNI can differ from Address, but it must match the existing server setup and certificate configuration. Do not choose one arbitrarily.
Address answers “where to connect”; SNI tells the TLS handshake “which server name to request.” A single endpoint may host multiple TLS services, so these fields do not always match. That does not mean you can choose any SNI: the server must recognize the name, and the certificate it returns should match the name the client expects.
When Address is an IP address, be sure to check the SNI supplied by the server. Replacing a domain with an IP may bypass the original address lookup, but it can also change the server name used by default and cause certificate verification to fail. If your existing settings do not specify SNI, do not guess. First confirm the name covered by the server certificate and the TLS settings in the original configuration.
Allow Insecure: Certificate Verification vs. Encryption
Allow Insecure controls TLS certificate verification; it does not control whether TLS is enabled. When enabled, the connection may still be encrypted with TLS, but the client no longer verifies the server certificate in the usual way, so the server’s identity is not confirmed. It also cannot correct an invalid Address, Port, or Password, so it should not be used as a general fix for connection failures.
Allow Insecure off
RecommendedCertificate verification stays enabled. If the certificate is expired, the name does not match, or the trust chain has an issue, check the certificate and SNI rather than bypassing verification.
Best for: Everyday connections with a valid certificate and matching name.
Allow Insecure on
Certificate verification is relaxed. TLS encryption does not mean the server’s identity has been verified. Even if the connection works again, that only points to certificate verification as something to investigate; it does not mean the configuration is correct.
Best for: Temporary, controlled diagnosis when you understand the certificate issue—not as a long-term fix.
If the connection fails with this option off but works when it is on, turn it off again and check the device’s date and time, the SNI spelling, the certificate’s validity period, and whether the server sends the complete certificate chain. A significantly incorrect device clock can also affect certificate validity checks. The lasting fix is to correct the settings or server certificate configuration, not to keep bypassing verification.
Manual Settings and Subscriptions: Check Their Sources Separately
Both manually added entries and imported subscription entries must match the server’s actual settings. The difference is who maintains those fields. If you already have a subscription, an update may include a changed Address, Port, or credential from the server. With a manual entry, you need to update changes yourself. Check the imported entry to see whether the subscription includes SNI, transport, and other fields; the entry name alone does not tell you.
How to check each source of settings
Manual setup
- Go to Home → “+” → Add Server and select Trojan for Type.
- Check Address, Port, Password, and SNI one by one.
- Update the local entry when the server settings change.
- Record the original values before troubleshooting, and change one setting at a time.
Existing subscription
- Go to Home → “+” → select Subscribe for Type, enter your own subscription URL, and save.
- Return to Home and pull down to refresh. Check whether the subscription successfully retrieved the entries.
- Open the target entry and check its imported Type and TLS settings.
- Later updates may overwrite local changes, so keep any troubleshooting notes you need.
A successful subscription update does not mean the Trojan connection works; test them separately. This site does not provide subscription content.
Another common mix-up is treating the server entry in Home and the routing configuration in Config as the same thing. The former describes how to connect to a proxy endpoint; the latter determines which policy a request uses. When Global Routing is set to Config, requests follow the active configuration. If a request matches DIRECT, it will not go through the selected Trojan entry.
- Proxy: Use this temporarily to rule out the effect of Config rules, then restore the previous routing mode. Still verify which proxy target is actually selected.
- Direct: Requests connect directly. A website opening in this mode does not prove that the Trojan settings work.
- Config: Requests follow the active configuration and its rules. Check the matching rule and the policy target it selects.
For example, in Config mode, DOMAIN-SUFFIX,example.com,DIRECT sends that domain and its subdomains to DIRECT. Check which rule matched instead of repeatedly changing the Trojan Password. Troubleshoot routing rules separately from protocol connectivity.
Connection Failures: Narrow Down the Cause
First, preserve the conditions needed to reproduce the issue: note the network, selected entry, Global Routing setting, whether Allow Insecure is on, and whether the failure occurs while fetching a subscription or making an actual request. Then change just one variable at a time. The checks below are conditional guidance, not test results for any particular service. The exact error text depends on what the app displays.
It keeps timing out. Does that mean the Password is wrong?
A timeout alone is not enough to tell. Go back to Home, edit the entry, and check Address and Port. Then retest the same settings over Wi-Fi and cellular. If the underlying connection has not been established, the request has not reached the Password authentication stage. Do not change the port, SNI, and Password at the same time.
I see a certificate error. Which field should I change?
First check the device’s date and time, then verify that the entry’s SNI matches your existing settings and that you have not entered https:// or a port by mistake. If the name is correct but the error persists, check the server certificate’s validity period and certificate chain. Do not treat enabling Allow Insecure as the final fix.
Why won’t webpages load even though there’s a latency result?
A latency test does not mean a complete request to the destination succeeded. First confirm that the target Trojan entry is selected in Home, then check whether Global Routing is set to Direct. If you use Config, check the policy matched by the request. To rule out the effect of routing rules, you can temporarily test with Proxy, then restore the original setting.
Why did my settings change again after updating the subscription?
Open the updated entry and compare Address, Port, Password, and SNI one by one. A subscription update may rewrite fields from its source. First check whether the configuration provided by the subscription has been corrected rather than repeatedly making unrecorded changes to the same entry.
Why does it reconnect automatically after I disconnect?
Go to Settings → On Demand and check whether On Demand is enabled, then check the VPN status in iOS. Automatic reconnection is a connection trigger, not proof that Trojan authentication succeeded. Keep the trigger conditions consistent while troubleshooting so an automatic reconnect is not mistaken for a successful configuration change.
A final check should confirm all three: the target entry matches your existing settings, TLS certificate verification succeeds, and an actual request expected to use the proxy completes. If only one website fails, also distinguish between a destination issue, DNS, and routing rules. Do not rewrite every server field just because a single destination fails. For details on DNS and connection triggers, see DNS settings and On Demand settings.