Shadowrocket Trojan Settings: Address, Port, Password, SNI & TLS

Learn how Trojan uses TLS and how to configure Address, Port, Password, and SNI in Add Server, plus how to avoid common setup mistakes.

At a glance

A Trojan connection requires three things: a reachable server, successful TLS authentication, and the correct password. For users with their own server parameters or subscription, this guide follows Home → Add Server to explain Address, Port, Password, and SNI, then uses certificate errors, connection timeouts, and pages that fail to load after connecting to help pinpoint problems. The domain names and IP addresses shown are examples for explaining fields, not working services.

1. Trojan parameters: connection destination and authentication

In short: Address specifies which server to connect to, and Port specifies its listening port. SNI is used during the TLS handshake, while Password authenticates the Trojan connection. These fields are not interchangeable, and entering port 443 does not mean the rest of the settings are correct.

A standard Trojan connection first establishes a TCP connection, then performs a TLS handshake, and finally sends Trojan authentication and request data through the encrypted tunnel. TLS provides encryption and server authentication; the Trojan password handles application-layer authentication. A valid certificate does not mean the password is correct, and a correct password cannot fix a certificate name mismatch.

443
Example of a commonly used TLS port; not a fixed port for every Trojan service
1–65535
Valid range for the destination port; the actual value depends on the server configuration
3 checks
TCP reachability → TLS handshake → Trojan authentication

2. Add a Trojan server in Add Server

Before adding a server manually, gather all your own connection parameters. At a minimum, confirm the protocol, server address, port, and password. If your configuration specifies an SNI or transport options, note those too. A server domain alone is not enough to determine the remaining authentication details.

  1. Open the Add Server screen

    Go to Home and tap “+” in the upper-right corner to open Add Server. To edit an existing entry, first keep a record of its current parameters so you do not overwrite a working configuration.

  2. Choose the protocol

    Select Trojan under Type, then return to the parameter screen. Do not enter another protocol’s password or identifier in a Trojan configuration. Different protocols can use the same port, such as 443, but their handshakes are not the same.

  3. Enter the connection destination

    Enter the server domain or IP address in Address and the corresponding port in Port. For example, use edge.example.com as a sample address and 443 as a sample port. Enter them in separate fields, without a URL path.

  4. Check authentication settings

    Enter your Trojan password in Password, and check the TLS and SNI settings against your original configuration. After pasting, check for leading or trailing spaces, line breaks, and incorrect capitalization. Do not URL-decode a password that has already been decoded.

  5. Save and test

    Tap Done to save, return to Home, select the entry, and connect. Test the same destination first, then adjust the settings one at a time. Changing only one parameter per test makes it easier to identify what affected the result.

Entries managed by a subscription may be rewritten during an update. To test a manual change, create a separate test entry rather than mistaking a setting restored by a subscription refresh for a failure to save. A share link and a subscription are also different: a single trojan:// URI represents one connection configuration, while a subscription URL retrieves and updates a set of configurations.

3. Trojan fields: Address, Port, Password, and SNI

Address and SNI can be the same or different. For example, the TCP connection can go to a specific IP while the TLS handshake uses the domain on the certificate. These fields serve different purposes, so this is not a contradiction. Use this setup only when your original configuration specifies it; do not try random domain substitutions.

FieldWhat to enterCommon mistakes and fixes
Address A domain name or IP address only, such as edge.example.com. Do not enter https://, a webpage path, or a complete share URI. If the domain does not resolve, check its spelling and the DNS settings on your current network first.
Port The port the server actually listens on, such as 443 or 8443. An example port is not a substitute for your actual settings. Do not include the colon in :443 when entering the numeric value.
Password The Trojan password configured on the server. This is not your subscription account password or a TLS certificate private key. Enter the application password exactly as provided, and watch for spaces included when copying it.
SNI The TLS server name specified by your original configuration, usually a domain name. Do not include a scheme, port, or path. Do not use an arbitrary website domain as a universal value, and do not confuse SNI with the HTTP Host header.
TLS The encrypted transport settings required by standard Trojan. Turning off TLS cannot fix a standard Trojan handshake problem. Any additional transport options must match the server configuration.

An empty SNI does not work for every server

Some configurations use the connection domain when SNI is left blank, but this behavior is not guaranteed in every case. If Address is an IP, in particular, confirm the expected server name and certificate identity. The certificate usually needs to cover the name used for authentication in its Subject Alternative Name. A certificate that lists only a domain may not be valid for direct IP verification.

4. Keep TLS certificate verification enabled

TLS does more than encrypt traffic. Certificate verification also checks whether the connected server has the expected identity. If a certificate error occurs, check the name, validity period, trust chain, and device time instead of disabling verification first. The comparison below concerns verification settings for the same connection.

Keep certificate verification enabled

Recommended

Check that SNI matches the certificate name, make sure the device date and time are correct, and ask the server operator to maintain a valid, complete certificate chain. A connection failure caused by an incorrect name or trust chain is useful diagnostic information that needs to be addressed.

Best for: Everyday connections and configurations you plan to keep

Skip certificate verification

Skipping verification weakens server identity checks. It does not fix DNS resolution, an unreachable port, or an incorrect password, and should not be a routine way to handle certificate errors.

For: Understanding the risks of an existing configuration—not as a procedure recommended in this guide

Certificate name matching and SNI-based server selection are related, but they are not the same process. A server may use SNI to select a certificate. If the wrong name is sent, the TCP connection may still succeed while the server returns a certificate for another site or rejects the connection. Check both the connection destination and TLS name; changing only the password will not address this issue.

5. Troubleshoot by failure stage

An enabled switch only means the client connection state changed; it does not mean every request succeeded. First check whether the request went through the Trojan entry being tested, then determine whether the problem is with the network, TLS, authentication, or rules. Before sharing error text, remove passwords, subscription tokens, and complete share links.

  1. Connection timed out: Check Address, Port, and your current network. If the domain does not resolve, troubleshoot DNS first. If the TCP port is unreachable, changing the password or SNI is unlikely to fix the problem at this stage.
  2. TLS handshake failed: Check the device time, SNI, certificate name, and certificate chain, and confirm that the destination port provides the required TLS service. Not every handshake failure is caused by an incorrect password.
  3. Connection closed after the handshake: Recheck Password, Type, and any additional transport requirements. An incorrect password may cause the connection to close or requests to fail, without showing a clear authentication error.
  4. Only some websites fail: Go to Home → Global Routing and check the current mode. Then open Config to review the active configuration and matching rules, and distinguish a rule-selection issue from a server connection problem.

Test with Proxy, Direct, and Config

In Global Routing, Proxy can help reduce interference from rules by routing requests normally controlled by this mode through the proxy policy. Direct connects without a proxy and does not prove that Trojan works. Config applies the active configuration rules. Scene depends on the settings for the current scene. Restore the original mode after a temporary test; do not leave the test mode enabled.

6. Trojan setup and connection FAQs

Why can’t I connect even though the port is 443?

443 is a commonly used port, but that does not prove Trojan is running on it. Go to Home, edit the entry, and check Type, Address, and Port against your original configuration, then check TLS and Password. If the server listens on port 8443, do not change it to 443.

Can I enter any common domain as the SNI?

No. SNI must match the server’s TLS configuration, and the verification name should also be covered by the certificate. Open the entry’s TLS settings and enter the domain from your original configuration without https://, a slash, or a port.

The imported password contains special characters. Should I change them?

Keep the imported value for now. A share URI may percent-encode special characters, and the import process decodes them. When entering a password manually, use the actual password and do not replace characters that have already been decoded. Check against your original configuration, and avoid pasting a complete URI on a public page.

What should I do if SNI changes back after a subscription update?

A subscription update may rewrite a managed entry. Create a separate Trojan test entry under Home, copy only the necessary parameters, and test it. Once you identify the difference, check the subscription contents with whoever maintains your configuration instead of repeatedly overwriting the same entry.

Is a password problem causing the connection to turn back on after I switch it off?

This is separate from whether the password is correct. Go to Settings → On Demand and check the on-demand connection settings. For testing, note and temporarily disable relevant automatic triggers, then return to Home to control the connection. Restore the original settings when you are done.

Download Shadowrocket