Proxy Protocols
VLESS iOS 6.0.0+ Mac 6.12.0+
VLESS is the lightweight proxy protocol of the Xray project. Surge implements the client side as Xray-core does, including REALITY, the XTLS Vision flow and VLESS Encryption.
[Proxy]
# RAW + REALITY + Vision, the most common deployment
Proxy-REALITY = vless, 1.2.3.4, 443, username=2cae91b3-f85c-433b-88ee-a002b9ed6d61, flow=xtls-rprx-vision, sni=www.microsoft.com, reality-public-key=dwrjY6KiAMPxKdlF7T4AWFXXBtsxeHCXtBQYeCOdZV4, reality-short-id=0123456789abcdef
# WebSocket + TLS, e.g. behind a CDN
Proxy-WS = vless, example.com, 443, username=2cae91b3-f85c-433b-88ee-a002b9ed6d61, ws=true, ws-path=/vless, tls=true
# RAW + TLS + Vision
Proxy-TLS = vless, example.com, 443, username=2cae91b3-f85c-433b-88ee-a002b9ed6d61, flow=xtls-rprx-vision, tls=true
# gRPC + TLS
Proxy-gRPC = vless, example.com, 443, username=2cae91b3-f85c-433b-88ee-a002b9ed6d61, grpc=true, grpc-service-name=mygrpc, tls=true
# XHTTP + REALITY (stream-one over HTTP/2)
Proxy-XHTTP = vless, 1.2.3.4, 443, username=2cae91b3-f85c-433b-88ee-a002b9ed6d61, sni=www.microsoft.com, reality-public-key=dwrjY6KiAMPxKdlF7T4AWFXXBtsxeHCXtBQYeCOdZV4, xhttp=true, xhttp-path=/xhttp
# XHTTP + TLS through a CDN (packet-up over HTTP/2)
Proxy-XHTTP-CDN = vless, cdn.example.com, 443, username=2cae91b3-f85c-433b-88ee-a002b9ed6d61, tls=true, xhttp=true, xhttp-path=/xhttp
# RAW + VLESS Encryption + Vision, no TLS (the key is shortened here)
Proxy-Enc = vless, 1.2.3.4, 443, username=2cae91b3-f85c-433b-88ee-a002b9ed6d61, flow=xtls-rprx-vision, encryption=mlkem768x25519plus.native.0rtt.vbS7cJA...Lc9lQ
Declaration syntax:
Name = vless, <host>, <port>, username=<user ID>[, parameter=value, ...]
Supported combinations:
| Transport | Security | Vision flow |
|---|---|---|
| RAW (TCP) | none, TLS, REALITY | With TLS, REALITY or VLESS Encryption |
| WebSocket | none, TLS | With VLESS Encryption |
| HTTPUpgrade | none, TLS | With VLESS Encryption |
| gRPC | TLS, REALITY | No |
| XHTTP | none, TLS, REALITY | With VLESS Encryption |
VLESS Encryption can be added to any of these combinations. The mKCP transport is not supported.
Parameters
username
Required.
The VLESS user ID (id in Xray). It is usually a UUID. Like Xray, Surge also accepts any other string of 1 to 30 bytes and maps it to a UUIDv5, so username=my-user matches a server whose client id is my-user.
flow
Optional, xtls-rprx-vision or xtls-rprx-vision-udp443.
Enables the XTLS Vision flow. It must match the server's setting for the user. Vision requires TLS 1.3 to the server, through tls=true or REALITY, and the RAW transport. With VLESS Encryption, Vision runs on the encryption layer instead: it needs no TLS and works with WebSocket and XHTTP too. Vision cannot be used with gRPC. Both values behave the same in Surge; use block-quic to control QUIC traffic.
reality-public-key
Optional.
The REALITY public key of the server (password or publicKey in Xray client configs, pbk in share links), as printed by xray x25519. Base64 with or without padding and URL-safe Base64 are accepted. Setting it enables REALITY, which implies TLS.
With REALITY, sni must be one of the serverNames configured on the server. The server's certificate is verified by the REALITY handshake instead of the system trust store, so skip-cert-verify and certificate pinning do not apply. Session resumption is disabled for REALITY connections.
REALITY connections send a browser's ClientHello, chosen with client-fingerprint (auto, i.e. apple-26, unless set; none counts as auto), so they look like an ordinary browser visiting the sni site. Only TLS 1.3 is accepted from the server.
REALITY servers older than Xray 25.5.16 cannot complete the handshake when the sni site answers the browser's ClientHello with the X25519MLKEM768 key exchange, which most large sites now do. Surge recognizes such a server on the first connection, connects again, and from then on sends it the same ClientHello without ML-KEM. Nothing needs to be configured. Servers running Xray 26.9.9 or later require X25519MLKEM768 and always get the unmodified ClientHello.
reality-short-id
Optional, default: empty.
The REALITY short ID (shortId / sid), up to 16 hexadecimal digits. It must be one of the server's shortIds. Requires reality-public-key.
encryption
Optional, default: none.
VLESS Encryption: a post-quantum ML-KEM-768 and X25519 key exchange that encrypts the VLESS stream itself, independently of the transport and of TLS. The value is the client string printed by xray vlessenc (encryption in Xray client configs), which must match the decryption setting of the server:
mlkem768x25519plus.<mode>.<handshake>[.<padding>].<key>[.<key>...]
<mode>:native,xorpub(the key exchange looks like random bytes) orrandom(every record header too, so nothing on the wire looks like TLS). It must match the server.<handshake>:1rttor0rtt. With0rtt, a connection reuses the ticket of an earlier full handshake while the ticket lifetime set by the server lasts (600sin the server'sdecryption), which saves one round trip. If the server no longer accepts the ticket, for example after a restart, that connection fails and the next one does a full handshake.<padding>: optional, Xray'sprobability-min-maxsegments, lengths and pauses alternating, for example100-111-1111.75-0-111.50-0-3333(the default). The first segment must have probability 100 and lengths of at least 35.<key>: the server's X25519 public key or ML-KEM-768 client key, in URL-safe Base64. Several keys separated by dots are for Xray's relay chains, in the order of the chain.
In the proxy editor, pasting the whole string into the Keys field fills in every field.
tls
Optional, Boolean, default: false.
Connect to the server over TLS. When enabled, the TLS parameters also apply. Not needed with REALITY.
ws
Optional, Boolean, default: false.
Use the WebSocket transport layer. See VMess for ws-path and ws-headers, which work the same way.
ws-http-upgrade
Optional, Boolean, default: false. Requires ws=true.
Use the HTTPUpgrade transport of Xray (network: httpupgrade) instead of WebSocket: the WebSocket upgrade request, then the data without WebSocket framing. See VMess for details.
Proxy-HTTPUpgrade = vless, cdn.example.com, 443, username=2cae91b3-f85c-433b-88ee-a002b9ed6d61, tls=true, ws=true, ws-http-upgrade=true, ws-path=/up
grpc
Optional, Boolean, default: false.
Use the gRPC transport ("gun" in Xray). It requires tls=true or REALITY. All connections of the policy are carried as streams of one HTTP/2 connection to the server.
grpc-service-name
Optional, default: empty.
The gRPC service name (serviceName), which must match the server. As in Xray, a plain name such as mygrpc is sent as the path /mygrpc/Tun, and a name starting with / is a custom path whose last segment names the stream method, for example /my/path/tun|tunmulti.
grpc-mode
Optional, gun or multi, default: gun.
multi uses the TunMulti method (Xray's multiMode). Servers accept both.
grpc-authority
Optional.
The :authority of the gRPC requests. Defaults to sni, or to the server hostname.
xhttp
Optional, Boolean, default: false.
Use the XHTTP transport of Xray (network: xhttp, formerly SplitHTTP), which carries the connection as ordinary HTTP requests that pass through CDNs and reverse proxies. It cannot be combined with ws or grpc. As in Xray, the HTTP version follows the TLS settings:
| Setting | HTTP version |
|---|---|
| REALITY | HTTP/2 |
tls=true |
HTTP/2 |
tls=true, alpn=http/1.1 |
HTTP/1.1 |
tls=true, alpn=h3 |
HTTP/3 over QUIC (UDP to the server port) |
| No TLS | HTTP/1.1 |
Connections of the policy share HTTP/2 and HTTP/3 connections to the server. Over HTTP/1.1 each connection uses its own requests.
xhttp-path
Optional, default: /.
The path of the requests (path), which must match the server. A query after ? is sent with every request.
xhttp-host
Optional.
The Host of the requests (host). Defaults to sni, then to the server address. With a CDN, this is usually the domain the CDN serves.
xhttp-mode
Optional, auto, packet-up, stream-up or stream-one, default: auto.
How the connection is carried (mode). The server must allow the mode; Xray servers allow all of them with their default auto.
stream-one: one POST request whose body carries the upload and whose response carries the download. Theautochoice with REALITY.stream-up: a GET request for the download and a streaming POST request for the upload. Needs a path that does not buffer request bodies.packet-up: a GET request for the download, with the upload split into numbered POST requests. Works through any CDN; theautochoice otherwise. Each POST carries at mostxhttp-max-each-post-bytesand POSTs start at leastxhttp-min-posts-intervalapart, which with the defaults limits a connection's upload to about 0.25 Gbps, as with Xray's client. There is no way to close only the upload direction in this mode.
xhttp-headers
Optional.
Extra request headers, in the format of ws-headers. Host is set with xhttp-host instead. Without a User-Agent, Surge sends Chrome's headers as Xray does; User-Agent set to chrome, firefox, safari, edge, curl or golang picks another browser, and any other value is sent as it is, without browser headers.
Obfuscation Parameters
Optional. The server checks these, so they must match its xhttpSettings. Each corresponds to the Xray setting in parentheses and takes the same values.
| Parameter | Xray | Default |
|---|---|---|
xhttp-padding-bytes |
xPaddingBytes |
100-1000 |
xhttp-padding-obfs |
xPaddingObfsMode |
false |
xhttp-padding-key |
xPaddingKey |
x_padding |
xhttp-padding-header |
xPaddingHeader |
X-Padding |
xhttp-padding-placement |
xPaddingPlacement: queryInHeader, header, cookie or query |
queryInHeader |
xhttp-padding-method |
xPaddingMethod: repeat-x or tokenish |
repeat-x |
xhttp-uplink-method |
uplinkHTTPMethod (GET only with packet-up) |
POST |
xhttp-session-placement |
sessionIDPlacement: path, query, header or cookie |
path |
xhttp-session-key |
sessionIDKey |
By placement |
xhttp-session-table |
sessionIDTable |
A UUID |
xhttp-session-length |
sessionIDLength |
|
xhttp-seq-placement |
seqPlacement |
path |
xhttp-seq-key |
seqKey |
By placement |
xhttp-uplink-data-placement |
uplinkDataPlacement: auto, body, header or cookie (the last two only with packet-up) |
auto |
xhttp-uplink-data-key |
uplinkDataKey |
By placement |
xhttp-uplink-chunk-size |
uplinkChunkSize |
By placement |
xhttp-no-grpc-header |
noGRPCHeader |
false |
Ranges are written as 100-1000 or a single number. With the upload data in headers or cookies, every POST carries its data base64-encoded in the request headers: lower xhttp-max-each-post-bytes to a few dozen KB at most, and raise the server's serverMaxHeaderBytes (8 KB by default) to match, or the server rejects the requests. Xray's client has the same limits.
Upload and Connection Parameters
Optional.
| Parameter | Xray | Default |
|---|---|---|
xhttp-max-each-post-bytes |
scMaxEachPostBytes |
1000000 |
xhttp-min-posts-interval |
scMinPostsIntervalMs (milliseconds) |
30 |
xhttp-xmux-max-concurrency |
xmux.maxConcurrency |
|
xhttp-xmux-max-connections |
xmux.maxConnections |
3 |
xhttp-xmux-max-reuse-times |
xmux.cMaxReuseTimes |
|
xhttp-xmux-max-request-times |
xmux.hMaxRequestTimes |
600-900 |
xhttp-xmux-max-reusable-secs |
xmux.hMaxReusableSecs |
1800-3000 |
xhttp-xmux-keep-alive |
xmux.hKeepAlivePeriod |
The XMUX defaults apply only when no xhttp-xmux-* parameter is given, as in Xray. A connection to the server stops taking new proxy connections once it reaches the concurrency, reuse, request or age limit. xhttp-xmux-max-connections and xhttp-xmux-keep-alive are accepted but have no effect: Surge does not spread proxy connections over several server connections, and uses its own keep-alive.
Splitting the upload and download onto different servers (downloadSettings) is not supported.
UDP Relay
VLESS supports UDP relay with no extra parameter. Surge sends UDP as XUDP, the default of Xray, sing-box and mihomo clients and the only form an Xray server accepts together with the Vision flow. One VLESS connection carries datagrams to any destination, which gives full-cone NAT behavior when the server supports it.
Share Link Parameters
The proxy editor can fill in a VLESS proxy from a share link. See Importing from Share Links.
vless://<id>@<host>:<port>?<query>#<name> links map to Surge parameters as follows:
| Share link | Surge |
|---|---|
<id> |
username |
type=tcp / type=raw |
(default) |
type=ws, path, host |
ws=true, ws-path, ws-headers=Host:<host> |
type=httpupgrade, path, host |
ws=true, ws-http-upgrade=true, ws-path, ws-headers=Host:<host> |
type=grpc, serviceName, authority |
grpc=true, grpc-service-name, grpc-authority |
mode=multi (with type=grpc) |
grpc-mode=multi |
type=xhttp (or splithttp), path, host, mode |
xhttp=true, xhttp-path, xhttp-host, xhttp-mode |
extra (with type=xhttp) |
The matching xhttp-* parameters. Server-only settings are ignored; downloadSettings is not supported |
security=tls |
tls=true |
security=reality, pbk, sid |
reality-public-key, reality-short-id |
sni |
sni |
flow |
flow |
alpn |
alpn |
allowInsecure=1 / insecure=1 |
skip-cert-verify=true |
pcs, vcn |
server-cert-fingerprint-sha256, server-cert-verify-name |
encryption |
encryption |
fp |
client-fingerprint, see Importing from Share Links |
spx |
Not used |
Links in the Shadowrocket form, vless://<base64 of none:<id>@<host>:<port>>?<query>, are also accepted. Their parameters map as follows: remarks is the name, tls=1 enables TLS (REALITY when pbk is present), peer is sni, xtls=2 is the Vision flow, obfs=websocket with path and obfsParam (the Host header) is WebSocket, and obfs=grpc with path (the service name) is gRPC.
See Also
- Common Policy Parameters — shared parameters such as
interface,tfo,test-url, andunderlying-proxy. - TLS Parameters — shared TLS parameters such as
skip-cert-verify,sni,alpn, and certificate pinning. - UDP Relay