Shadowrocket Trojan Setup: How the Protocol Works and How to Fill In Add Server

Learn how Trojan uses TLS, then see how to enter Address, Port, Password, SNI, and certificate settings in Add Server—and how to troubleshoot mistakes.

At a glance

This guide is for users who already have server details from their provider and want to add a Trojan server manually in Shadowrocket. First, distinguish the server address, TLS identity, and protocol password. Then fill in the Add Server fields, save, and test the connection. Finally, troubleshoot based on where the connection fails. Get subscriptions and server details from your provider. The domains and settings in this guide are examples to explain the fields, not usable connection details.

How Trojan Works: TLS First, Then Protocol Authentication

Trojan carries proxy traffic over an encrypted TLS connection. A typical basic connection uses TCP: the client connects to the server address and port, completes the TLS handshake and certificate verification, then sends Trojan authentication details and the target request. The server forwards traffic only after authentication succeeds. So “port reachable,” “TLS handshake successful,” “password accepted,” and “website accessible” are separate checks; none can stand in for another.

Server lookup TCP connection TLS handshake Protocol authentication Traffic forwarding

TLS encrypts the connection and verifies the server’s identity. The Trojan password authenticates access to the protocol; these serve different purposes. A correct password won’t fix an expired certificate, and a valid certificate doesn’t mean the password is correct. If a server uses port 443, that only means it accepts connections on that port—not that it necessarily runs Trojan.

443
A common TLS service port; use the value provided by your service provider
1–65535
The destination port must match the port the server is listening on
Two types of credentials
The certificate verifies the server’s identity; Password authenticates Trojan access

This guide covers basic Trojan over TLS. If your provider also specifies WebSocket, a path, or other transport settings, Address, Port, and Password alone may not be enough to connect. Check the complete set of details from the same configuration. Don’t mix SNI, Password, or transport settings from different services.

Before Add Server: Gather the Complete Settings

Before entering anything manually, confirm that the details explicitly specify Trojan; don’t infer the protocol from a port or domain alone. Importing a subscription preserves the complete set of fields supplied by your provider. Manual setup is useful when you want to check each setting yourself. Both methods use the same connection details; the difference is who enters them.

Home → Add Server: Enter Address, Port, and Password

On Home, tap the add button in the upper-right corner to open Add Server. Set Type to Trojan, then fill in the fields below. Field order and optional settings may vary in the current app interface. Match each detail to its field by meaning rather than relying on the position shown in an older screenshot.

FieldWhat to enterWhat can happen if it’s wrong
TypeSelect Trojan to match the server protocolThe address may be reachable, but protocol authentication may fail
AddressThe hostname or IP provided by your service provider, such as edge.example.comDNS lookup may fail, the wrong address may be reached, or the connection may time out
PortThe port the server listens on, such as 443The connection may be refused or time out, or reach a different service
PasswordThe exact Trojan password provided by your service providerTLS may succeed, but authentication or a later request may fail
SNIThe TLS hostname specified by your service provider, such as tls.example.comThe wrong certificate may be presented, or hostname verification may fail
Allow InsecureFor a standard valid certificate setup, leave certificate verification enabledTurning this on weakens server identity verification; it won’t fix incorrect connection settings
  1. Enter Type, Address, and Port first. Make sure the port isn’t duplicated in Address.
  2. Paste the Password and check that every character is present. Enter the password as provided; don’t URL-encode it yourself.
  3. Set SNI according to your details and check the certificate verification option. Include any required transport settings.
  4. Save, return to Home, select the new entry, then connect. If iOS asks to add a VPN configuration, follow the system prompt.

Matching ports don’t make settings interchangeable, and changing Port won’t change the server’s listening configuration. If no port is provided, ask your service provider instead of trying common ports one after another. Password is also not your app purchase password or device passcode.

SNI and Certificate Verification: The Address Isn’t the Identity

Address determines where the client connects. SNI is the server name sent in the TLS handshake, allowing the server to select the appropriate site and certificate. In a typical domain-based setup, the client also needs to verify that the certificate is trusted, within its validity period, and matches the expected identity. SNI is neither a password nor a switch that makes a certificate trusted.

Details from your service providerWhat to check
Address and TLS hostname are the sameEnter the same hostname as provided, without a scheme or path
Address is an IP, with a separate SNI specifiedUse the IP for the address and the specified hostname for TLS; keep the two values separate
Address and SNI are different domainsKeep the pairing provided by your service provider; don’t change SNI to match Address
Certificate verification failsCheck the device’s date and time, SNI, certificate validity, and trust chain, then confirm the server’s certificate configuration

In short: If you see a certificate error, check the identity first—don’t skip verification

Leave Allow Insecure off. First, check that SNI exactly matches your provider’s instructions. If the error persists with the correct date and time, ask your provider to check the certificate chain and validity period.

For example, if the connection address is an IP but the server certificate is issued to tls.example.com, you can’t simply use that IP as the certificate name. Conversely, entering an unrelated website domain won’t give the server its certificate or configure its site automatically. SNI must be a name the connection actually supports.

Custom certificates or special trust settings require separate verification. Don’t leave certificate verification disabled just to make an error disappear temporarily. A successful TLS handshake only describes the connection between the client and that server; it doesn’t mean every destination website is reachable.

After Saving: Separate Protocol Issues from Routing Issues

Saving successfully only means the settings are stored locally; it doesn’t mean the server has authenticated you. First check the selected entry and Global Routing, then run a repeatable access test. Under Config, rules determine the policy for each request; some requests may use DIRECT. So one website loading doesn’t prove that Trojan is working.

  1. Check the selected entry: Return to Home and make sure the newly saved Trojan entry is selected, not another item in the list.
  2. Check the routing mode: In Global Routing, see whether the current mode is Proxy, Direct, Config, or Scene. Direct won’t test this proxy. For Scene, first check which policy it actually uses.
  3. Run an isolated test: If needed, switch to Proxy briefly and test a known HTTPS page you’re authorized to access. Restore your previous setting when done. Proxy helps rule out routing as a variable; it won’t fix an incorrect password.
  4. Check request logs: Use the request log and any available error details to distinguish DNS lookup, connection, TLS, and subsequent forwarding stages. Interpret test results according to the test type; a latency reading alone doesn’t prove the service is fully usable.
  5. Recheck Config: If Proxy works but Config doesn’t, check rule order and the associated policy. Confirm that the request actually selects the expected proxy.

Rules are generally matched from top to bottom, and the first match determines the policy. The example below illustrates rule behavior; it isn’t a complete configuration to replace your existing Config. In an actual configuration, PROXY must refer to an available policy.

[Rule]
DOMAIN-SUFFIX,example.com,PROXY
FINAL,DIRECT

This example routes example.com and its subdomains through PROXY, while unmatched requests go through DIRECT. If you test only a different domain, its traffic may never use Trojan. The same applies to rules such as GEOIP and IP-CIDR in your configuration: first identify which rule matched, then check whether the outbound settings are at fault. Put FINAL at the end of the rules.

Troubleshooting: Check the Failure Stage Instead of Rebuilding Repeatedly

The steps below are troubleshooting pointers, not definitive diagnoses for any single error. The same timeout could mean the address is unreachable, the server isn’t responding, or a later request isn’t getting a response. Consider the error together with the stage where it occurs.

Address and password are entered, but the connection keeps timing out. Why?

Return to Home and edit the entry. First check that Address doesn’t include a scheme, path, or spaces, then confirm that Port matches the details from your service provider. If the connection hasn’t been established, changing Password usually won’t help diagnose the issue. Repeat the same test on another available network, then ask your provider to confirm the status of that address and port.

I’m getting a certificate error. Should I turn on Allow Insecure?

Leave it off for now. Check the device’s date and time, then compare SNI with your provider’s details and make sure you haven’t pasted a full URL. If the error persists, ask your provider to check the certificate name, validity period, and complete certificate chain. Skipping verification won’t fix an incorrect port or prove that you’re connected to the intended server.

TLS shows no error, but webpages still won’t load. What should I check first?

First check the selected entry and Global Routing, then look for extra spaces in Password or missing transport settings. If Proxy works but Config doesn’t, check the rules and policies. If both modes fail, use the request log to continue checking authentication and server-side forwarding.

There’s already a Trojan entry in my subscription. Do I need to add it manually too?

Usually not. Start with the subscription from your service provider and check that the imported entry is complete. If you need to test it manually, save a separate entry with a distinct name. Subscription updates usually don’t update separately created manual entries, so check them individually if the password or address changes.

Can I change SNI to any domain to fix a connection failure?

No. An arbitrary domain isn’t a universal fix. SNI affects which TLS site the server selects, and the certificate must still meet identity verification requirements. Restore the value specified by your service provider, then investigate certificate or network issues. If additional Host or path settings are required, keep them paired with the same configuration.

Verify the Official App Store Listing