r/VPN 23h ago

Help How to setup zero-rated VLESS with multi-level subdomain on Cloudflare?

3 Upvotes

Hey guys, I'm trying to replicate this client config on my own server. Here's the working config from my friend:
JSON

{
"server": "www.domain.com",
"server_port": 443,
"tag": "Test",
"type": "vless",
"uuid": "942hdiwa-9e01-460a-iud76",
"packet_encoding": "xudp",
"tls": {
"enabled": true,
"server_name": "www.domain.com.mydomain.com",
"utls": {
"enabled": true
}
},
"transport": {
"type": "ws",
"path": "/vws/",
"headers": {
"Host": [
"www.domain.com.mydomain.com"
]
}
}
}

Where:
www.domain.com is the zero-rated domain (on Cloudflare)

mydomain.com is my domain (also on Cloudflare, pointing to my VPS)

My friend says this works on any V2Ray app with zero configuration — just paste the link and it connects. No hosts file edits needed.
I have:
A VPS with 3X-UI running

mydomain.com on Cloudflare with DNS pointing to my VPS

A Let's Encrypt cert for www.domain.com.mydomain.com via acme.sh DNS challenge

But I'm stuck on the server-side setup. I don't know how to configure 3X-UI/Xray so that:
Clients can connect using www.domain.com as the server address

The TLS handshake validates www.domain.com.mydomain.com properly

It works without requiring clients to edit their hosts file

I suspect my friend is using Cloudflare Advanced Certificate Manager for the multi-level subdomain cert, but I want to confirm if there's a free way to do this before paying.

Can anyone point me in the right direction for the server-side config? What am I missing?

Thanks!