Description
Integrity requirements
- I have read all the comments in the issue template and ensured that this issue meets the requirements.
- I confirm that I have read the documentation and understand the relevant configuration items.
- I provide a minimal, sanitized reproduction and logs; secrets such as UUID, private key, public key, and shortId are redacted.
- I searched existing issues and did not find an exact duplicate for this server-side REALITY target Certificate record size failure.
- The problem can be reproduced on the latest release.
Description
VLESS + TCP + REALITY + Vision fails when using www.microsoft.com:443 as REALITY dest / serverNames on Xray-core v26.3.27.
This is not a direct TLS rejection by Microsoft: direct openssl s_client and curl from the same server to www.microsoft.com:443 succeed. The failure appears to be caused by the REALITY server-side target handshake parser rejecting a Microsoft TLS Certificate record whose length is slightly larger than the hardcoded 8192 byte limit in github.com/xtls/reality.
In this environment, Microsoft returns a TLS Certificate record length that leads REALITY to log Certificate: 8273, which is larger than size = 8192, and then the REALITY connection is rejected with handshake did not complete successfully.
Environment
- Xray-core:
Xray 26.3.27 (Xray, Penetrates Everything.) d2758a0 (go1.26.1 linux/amd64) - OS: Linux x86_64
- Protocol: VLESS + TCP + REALITY +
xtls-rprx-vision - REALITY dest/serverName:
www.microsoft.com:443/www.microsoft.com - Client REALITY fingerprint:
chrome
Sanitized server config shape
{
"log": { "loglevel": "debug" },
"inbounds": [
{
"listen": "0.0.0.0",
"port": 443,
"protocol": "vless",
"settings": {
"clients": [
{
"id": "<redacted-uuid>",
"flow": "xtls-rprx-vision"
}
],
"decryption": "none"
},
"streamSettings": {
"network": "tcp",
"security": "reality",
"realitySettings": {
"show": true,
"dest": "www.microsoft.com:443",
"xver": 0,
"serverNames": ["www.microsoft.com"],
"privateKey": "<redacted>",
"shortIds": ["<redacted>"]
}
}
}
],
"outbounds": [{ "protocol": "freedom", "tag": "direct" }]
}Client uses matching VLESS REALITY settings with:
security=reality
sni=www.microsoft.com
fp=chrome
flow=xtls-rprx-vision
type=tcp
Reproduction
- Start Xray server with REALITY
dest: "www.microsoft.com:443",serverNames: ["www.microsoft.com"],show: true. - Use a matching Xray client on the same host or from another host.
- Send a request through the client, for example:
curl --socks5-hostname 127.0.0.1:<local-socks-port> https://www.google.com/generate_204Observed client-side result:
curl: (35) Recv failure: Connection reset by peer
HTTP=000 ERR=Recv failure: Connection reset by peer
REALITY debug log
Relevant sanitized server-side REALITY logs:
REALITY remoteAddr: 127.0.0.1:<port>
REALITY remoteAddr: 127.0.0.1:<port> hs.c.ClientVer: [26 3 27]
REALITY remoteAddr: 127.0.0.1:<port> hs.c.ClientTime: 2026-06-21 ... UTC
REALITY remoteAddr: 127.0.0.1:<port> hs.c.ClientShortId: [<redacted>]
REALITY remoteAddr: 127.0.0.1:<port> hs.c.conn == conn: true
REALITY remoteAddr: 127.0.0.1:<port> len(s2cSaved): 5524 Server Hello: 127
REALITY remoteAddr: 127.0.0.1:<port> len(s2cSaved): 5397 Change Cipher Spec: 6
REALITY remoteAddr: 127.0.0.1:<port> len(s2cSaved): 5391 Encrypted Extensions: 51
REALITY remoteAddr: 127.0.0.1:<port> len(s2cSaved): 5340 Certificate: 8273
REALITY remoteAddr: 127.0.0.1:<port> hs.c.isHandshakeComplete.Load(): false
transport/internet/tcp: REALITY: processed invalid connection from 127.0.0.1:<port>: handshake did not complete successfully
Direct TLS to Microsoft succeeds
From the same server, direct TLS to Microsoft succeeds:
openssl s_client -connect www.microsoft.com:443 -servername www.microsoft.com -tls1_3 -brief </dev/nullOutput excerpt:
CONNECTION ESTABLISHED
Protocol version: TLSv1.3
Ciphersuite: TLS_AES_256_GCM_SHA384
Peer certificate: C = US, ST = WA, L = Redmond, O = Microsoft Corporation, CN = www.microsoft.com
Verification: OK
DONE
curl https://www.microsoft.com/ also returns HTTP 200 from the same server.
Microsoft Certificate record size
With openssl -msg, Microsoft returns a Certificate record that can exceed the REALITY hardcoded size limit when OCSP/status is involved:
openssl s_client -connect www.microsoft.com:443 -servername www.microsoft.com -tls1_3 -status -msg </dev/nullRelevant output:
<<< TLS 1.2, RecordHeader [length 0005]
17 03 03 20 4c
<<< TLS 1.3, Handshake [length 203b], Certificate
0x204c + 5 = 8273, matching the REALITY debug log line:
Certificate: 8273
Suspected root cause
In github.com/xtls/reality tls.go, the current code appears to have a hardcoded 8192 byte limit:
var (
size = 8192
...
)
...
handshakeLen = recordHeaderLen + Value(s2cSaved[3:5]...)
...
if handshakeLen > size { // too long
break f
}For this Microsoft target, REALITY computes:
handshakeLen = 8273
size = 8192
8273 > 8192
So the target TLS handshake is rejected as too long, and the connection fails with:
handshake did not complete successfully
Control test
Using the same UUID/key/flow/shortId/client, changing only the REALITY target to another site succeeds. For example:
www.bing.com:443+serverNames: ["www.bing.com"]succeeds.- Other tested targets such as Cloudflare/Apple/Amazon also succeeded in the same environment.
This suggests the failure is target-handshake-size dependent rather than a UUID/key/shortId/flow mismatch.
Expected behavior
REALITY should either:
- handle valid target TLS Certificate records slightly larger than 8192 bytes, or
- expose a clearer error such as
target TLS record too long: 8273 > 8192, or - document that target TLS records must be <= 8192 bytes and that large OCSP-stapled certificate records are unsupported.
Actual behavior
The connection is reset and server logs only:
handshake did not complete successfully
This makes it look like a generic REALITY handshake/authentication failure, even though the specific cause appears to be the target Certificate record exceeding the hardcoded 8192 byte limit.
Activity
Fangliding commentedon Jun 22, 2026
Microsoft 似乎对部分地区才返回 OCSP 数据 否则可以正常运行
j2gg0s commentedon Jun 23, 2026
Confirming the same root cause hits the metacubex/utls fork (used by sing-box and mihomo), not just
xtls/reality— adding quantitative data and a verified workaround for anyone landing here.Same constant in metacubex/utls (
reality.go, header// modify from XTLS/REALITY):So
sing-box 1.13.13(server) +metacubex/utls v1.8.4reject valid clients withREALITY: processed invalid connectionfor exactly the same reason as Xray. (Bothmetacubex/utlsandXTLS/REALITYhave GitHub issues disabled, hence cross-posting the confirmation here.)Deterministic, not a concurrency race. sing-box maps REALITY's
config.Log→logger.Trace, so withlog.level: tracea 120-parallel burst gave per-dial establish 118/393 ≈ 30 %, with a perfectly bimodal split:isHandshakeComplete: truebreak f→ processed invalidCPU/fd are idle. Concurrency only matters because more simultaneous dials sample more Microsoft CDN edges, so the 8273 (OCSP-stapled) variant is hit more often — that's why single connections look fine while bursts mostly fail.
Fix verified by changing dest only (same uuid / key / shortId /
flow: xtls-rprx-vision):One caveat for picking a dest:
openssl s_client -showcertschain DER is not a reliable predictor. Microsoft's chain DER is stable (~5879 B); the extra ~2 KB that pushes the record past 8192 is the per-cert OCSP-staple / SCT extensions inside the TLS Certificate message, which a chain-DER measurement omits. The reliable check is the record length REALITY logs (Certificate: <n>), oropenssl -msg -status.+1 to the asks here: raising the limit (e.g. 16384) and/or emitting a specific error such as
REALITY: target TLS record too long: 8273 > 8192would stop this from masquerading as a generic auth failure.winoros commentedon Jun 23, 2026
I met the problem. Solved by using another domain like
dl.google.com.fix(xray): move REALITY dest off www.microsoft.com to steal-oneself (#92
zhujhz commentedon Jun 25, 2026
I can confirm a similar target-specific REALITY handshake failure in another VPS deployment.
Environment
26.3.27www.microsoft.comDanOps-1/Xray-VPN-OneClickone-click installerSymptoms
handshake did not complete successfullyAdditional finding
The failure appears target-specific:
www.microsoft.comas REALITY target/SNI failedapi.ipify.orgreturned the VPS exit IPwww.google.comreturned HTTP 200api.openai.com/v1/modelsreturned HTTP 401, which is expected without API authenticationProvision 3.4.x clients with non-empty email; document Reality dest l…
fengchen-github commentedon Jun 28, 2026
Saved my life
mtsblogs commentedon Jun 28, 2026
The proposed fix (link below) has worked.
For anyone else encountering this issue, you can ask your favourite AI agent to help you apply the fix proposed here. It will give you instructions how to compile your version of xray vps with this bigger buffer value in reality. No config changes will be required and all will just work.
TXIuTnVsbA commentedon Jun 28, 2026
我也遇到了这个问题,然后我用苹果的好像也是这样,最后我只能用特斯拉的才没事。
fasmat commentedon Jun 28, 2026
Ran into the same issue - should have checked the issue tracker first and saved hours of debugging and trying.
Using Xray 26.6.1 and switching from microsoft.com to apple.com solved the issue for now, thanks to @fanyangCS for reporting and @winoros for providing a quick solution.
papka1974 commentedon Jun 28, 2026
Any chance to get this fixed ASAP? In my case, I can't use quick fix, since having quite some clients, that will be forced to do updates on their side....
R8s6 commentedon Jun 30, 2026
i confirm docker container built against this patch is now working, without any change in server / client configs.
RPRX commentedon Jul 3, 2026
不急着修复这问题是因为微软在中国境内有服务器,本来就不建议偷微软(俄罗斯的情况可能不同?),总之下个版本会修复
R8s6 commentedon Jul 3, 2026
@RPRX 对在中国翻墙的人来说, 请问推荐伪装成哪个域名比较好? 或许在某个文档里提及一下会比较好. 谢谢
我猜很多人之所以选择 www.microsoft.com, 可能是因为 Xray-core Github 主页链接的 Reality 教程 有提到:
papka1974 commentedon Jul 13, 2026
Was this included in v26.7.11?
gnimian commentedon Jul 14, 2026
I should have checked earlier and saved myself of 8 hours of debugging! At first, I thought it was a MDM profile or a local background security process killing the connection. Especially because shadowrocket worked completely fine on my phone with the Microsoft destination. Never suspected it to be the CDN itself. Huge thanks!
docs: 记录 upstream 对 REALITY+Finalmask 组合的架构立场 (PR#6497 被关)
Смена рамки: репозиторий про решённую проблему, а не про сборку стека
Fix VLESS/Xray REALITY never actually connecting: www.microsoft.com d…
braska commentedon Aug 22, 2026
@RPRX On July 3 you mentioned this would be fixed in the next version — it's been several weeks and a few releases (up to v26.7.28) without movement; master still pins
xtls/reality v0.0.0-20260322...wheresize = 8192. Is XTLS/REALITY#33 still the planned fix, or is something else holding it up? Happy to keep patching locally in the meantime, just trying to plan around it.Increase REALITY target TLS record buffer to 17 KiB (#33)
Update github.com/xtls/reality to 20260908062103
fix(deps): xtls/reality 升到含 17KiB 缓冲修复的版本
fix(deps): move the reality pin past its broken probe commit
Make the real-VM verifier pass against a correct v4 deploy
xxX-Fox-Xxx commentedon Oct 16, 2026
I can confirm this issue on Xray 26.6.27, managed by 3x-ui 3.6.0, running on Ubuntu 24.04.
VLESS TCP + REALITY + Vision stopped passing traffic when using
www.microsoft.com:443as the REALITY target. The server accepted connections, but websites would not load through the VPN.Packet capture showed that port 443 was reachable and the TCP handshake completed. The client then sent approximately 1.9 KB of initial data. The server acknowledged it and closed the connection with FIN, without sending any TLS payload. The client kept retrying.
To isolate the failure, we ran a temporary Xray client on the VPS and connected to the existing inbound over loopback. The same failure occurred locally, so neither the home network nor ISP filtering was required to reproduce it. Ordinary TLS connections from the VPS to Microsoft succeeded.
An isolated test server using the same REALITY credentials produced these diagnostic lines:
REALITY authentication passed, but processing the target’s response failed. Microsoft returned a 8273-byte Certificate TLS record, exceeding the 8192-byte limit in the REALITY implementation used by this version.
This explains why checking port availability and establishing an ordinary TLS connection to the target did not reveal the problem: the failure occurred inside REALITY’s handshake processing.
Connectivity was restored by changing the server target and updating the client SNI consistently:
UUIDs, keys, short IDs, port 443 and
flow=xtls-rprx-visionwere preserved. After the change, HTTPS requests through the production TCP inbound returned HTTP 200 with bothchromeandfirefoxfingerprints. Connectivity from the previously affected home network was also restored.Clients need to refresh their subscriptions or update the SNI in manually imported profiles. NVIDIA worked for this deployment; the suitability of a target should be tested for each server.
These results confirm the existing issue on version 26.6.27, not a regression in a release containing the fix. The core was not upgraded during this investigation.
fix(xray): move REALITY dest off www.microsoft.com to steal-oneself (#92
fix(xray): move REALITY dest off www.microsoft.com to steal-oneself (#92