Reality target and SNI: how to choose the site to hide behind

The target is someone else's real website whose TLS handshake a Reality server borrows. On the server it is set in dest (target in newer Xray) and serverNames, and in every client link it is the sni. A good one answers TLS 1.3 with X25519 and HTTP/2 on port 443, doesn't redirect elsewhere, is close to your server and isn't on a shared CDN. Fame doesn't matter: measure a few candidates from your server and keep the nearest that passes.

Updated

On this page

Where the site goes: dest, serverNames and sni

Reality has no domain or certificate of its own. A stranger's connection is passed on to the target whole, so a prober sees that real site. For your own client the server still connects to the target and builds its answer on the real handshake. So the target is contacted on every new connection, yours and everybody else's.

On the server the site sits in realitySettings, and the link carries the same name in sni=:

config.json
{
  "realitySettings": {
    "target": "www.example.com:443",
    "serverNames": ["www.example.com"],
    "privateKey": "…",
    "shortIds": ["…"]
  }
}
  • dest (target in newer Xray) — the site and port the server connects to. Current Xray takes either name.
  • serverNames — the names a client may send. Usually one, the same as in dest, written exactly: with or without www..
  • sni — in the vless:// link, one of the serverNames. In an Xray client config it is serverName, in sing-box server_name.

What the site must have

  • TLS 1.3 — Reality works only over TLS 1.3. A site that stops at TLS 1.2 can't be borrowed.
  • X25519 key exchange — the client offers X25519, as browsers do, and the target has to accept it. Most modern sites do; check rather than assume.
  • HTTP/2 (h2) — browsers, and the clients that imitate them, offer h2 first. A site that answers with it looks like an ordinary visit.
  • Port 443 and no redirect to another domain — if example.com sends visitors on to www.example.com, take www.example.com. A redirect within the same name, to a language page for example, is fine.
  • Close to the server — the server connects to the target on every new connection of every client, so the whole handshake there is added to each one. A distant target adds a pause to every connection, and a page opens many.
  • Not on a shared CDN address — if the target's address is a CDN edge that serves all its customers' sites by name, strangers can send other names to your server and reach those sites through it, on your traffic.

Why fame and SNI lists don't decide it

Lists of “the best Reality SNI” and online SNI scanners tell you which sites worked for someone else, from their server, on the day they checked. A site that answers in 5 ms from one data center can take 300 ms from yours, and its TLS settings can change when it moves to another CDN. Fame doesn't help either: a huge site's name at a small hosting provider's address is easier to notice, and a name from a popular list shows up on thousands of servers unrelated to its owner.

Use them for candidates only. Scanners such as XTLS's RealiTLScanner go through addresses, often the ones next to your server's, and print the sites that answer TLS 1.3 with HTTP/2 along with the names in their certificates. Scan from your own computer, not a rented server: a hosting provider can take scanning for abuse. Then check each candidate from the server.

How to check a site from your server

Run these on the server: only its own distance and network matter. Put the candidate in place of www.example.com and compare three to five of them.

On the server
xray tls ping www.example.com

Connects without SNI, then with it, and prints the TLS version and the certificate's names. With SNI it must succeed over TLS 1.3; a failure without SNI is normal.

On the server
curl -so /dev/null --tlsv1.3 --http2 --curves X25519 -w '%{http_version} %{time_appconnect}\n' https://www.example.com/

2 0.041 means HTTP/2 and 0.041 seconds until the TLS handshake was done, name lookup and TCP included. 1.1 means no HTTP/2; 0 0.000000 means TLS 1.3 with X25519 failed. Take the lowest of two or three runs: tens of milliseconds is near, hundreds is far. Without --curves, curl is older than 7.73.

On the server
curl -so /dev/null -w '%{http_code} %{redirect_url}\n' https://www.example.com/

200 with nothing after it: the page opens under this name. 301 or 302 with an address is a redirect; to another domain, check that domain instead.

On the server
curl -sI https://www.example.com/ | grep -iE '^(server|via|cf-ray):'

Shows who answers. A cf-ray line or server: cloudflare means Cloudflare, where one address serves a great many sites: pick another target.

Switching to another site

Starting from scratch? /tools/reality-keys/ makes keys, a shortId, a server config.json and a vless:// link for the site you type.

  1. 1

    Change the server's settings

    Put the new name with :443 into dest (or target) and the same name into serverNames. Check the file with xray run -test -config /usr/local/etc/xray/config.json, then run systemctl restart xray.

  2. 2

    Change sni in every link

    Each link needs the new name in sni=. If clients take links from a panel's subscription, change the site in the panel: the links follow at the next refresh.

  3. 3

    Keep everything else

    The keys, shortIds, UUIDs, flow and fp stay as they were.

  4. 4

    Check one client

    Connect once and read journalctl -u xray -n 20 --no-pager. A link with the old name is turned away, and the client says reality verification failed.

What you see, the cause and what to do

  • reality verification failed right after changing the site

    CauseThe link still carries the old sni, which is no longer in serverNames

    What to doPut the new name into sni in every link, or refresh the subscription

  • Every client fails with EOF or a timeout after the change

    CauseThe server can't reach the new site, or the site lacks TLS 1.3 with X25519

    What to doRun the curl check on the server and pick a site that passes

  • Each new connection hangs for a moment, then the speed is fine

    CauseThe site is far from the server: its handshake is added to every connection

    What to doCompare a few candidates and take one in the tens of milliseconds

  • The site redirects: 301 or 302 to another domain

    CauseThe name only sends visitors elsewhere

    What to doCheck the name it leads to; if that answers 200, use it

  • cf-ray or server: cloudflare in the headers

    CauseThe site is behind a CDN address shared by many sites, which strangers can reach through your server

    What to doPick a site that isn't behind such a CDN

  • curl prints 1.1 or 0 0.000000, xray tls ping shows TLS 1.2

    CauseNo HTTP/2, TLS 1.2 only, or no X25519

    What to doPick another site

In Veli

Veli measures the site from your server

When you install VLESS Reality on your own server from Veli (Profiles → Add → “Your own server”), the site is set under “Customize”, in “Site to hide behind”. Left at “The nearest to the server, picked by itself”, the install measures six sites from the server itself: www.samsung.com, www.nvidia.com, dl.google.com, www.apple.com, www.intel.com and www.asus.com, each over TCP and TLS 1.3 with X25519 and HTTP/2, twice. A site that fails either round is out, and www.samsung.com stays unless another answers more than 20 ms sooner. microsoft.com is left out: its handshake breaks Reality. “Steps and the server log” names the site picked and its milliseconds.

You can also type your own site. At the end a throwaway client on the server connects through Reality, proving keys, name and site together; if the site fails, the install stops: “The Reality self-test failed: … does not open from the server as a masking site. Pick another masking site and install again”. The server screen shows the site in use (“masking as …”). To switch later, choose “Reinstall” in the protocol's “⋯” menu and enter another site. Reinstalling creates new keys: old links stop connecting, and each device gets a new one through “Add a device”.

FAQ

What is dest (target) in Xray Reality?

The real website a Reality server borrows its TLS handshake from and passes strangers' connections to, written with the port: www.example.com:443. Newer Xray calls it target.

Do serverNames and sni have to match dest?

The sni in the link must be exactly one of serverNames, with or without www as written there. Usually all three carry one name: the site in dest.

Where can I find a list of working Reality SNI?

Lists and scanners only give candidates, measured from someone else's server. Check each one from your own server for TLS 1.3, X25519 and HTTP/2, and take the nearest that passes.

Do I need new keys when I change the site?

No. Change dest and serverNames on the server and sni in every link; the keys, shortId and UUIDs stay the same.

Why does every new Reality connection start slowly?

Usually the target is far from the server, which connects to it on every new connection. A nearer site removes the pause.

Let the install pick the site

Veli installs VLESS Reality on your own server over SSH, measures its candidate sites from the server itself or takes the one you type, and proves it with a client on the server.