Skip to content
GitHubSupport

Getting through whitelists over a CDN

When an operator leaves only a whitelist working — messengers, state services, banks — ordinary protocols go silent. A CDN gives you an address that is on that list: the client dials the distribution domain, the CDN network accepts the request and reaches the origin on your node over a separate connection.

client ──TLS──> cdn.example.com (distribution domain, DNS points at the CDN)
CDN ──TLS──> origin.example.com (origin domain, DNS points at the node)
└── mihomo on the node
  1. A node with a public IPv4 (the panel’s Nodes).
  2. Two names: an origin domain (pointing at the node) and a distribution domain (pointing at the CDN).
  3. A certificate for the origin domain — the panel issues it itself once the domain is set on the node card.
  4. A distribution domain with a certificate on the CDN’s side — usually the provider issues it.
  5. A CDN with a pull-origin mode. Suitable providers are listed below.

Step 1. The origin domain and the node’s certificate

Section titled “Step 1. The origin domain and the node’s certificate”

The origin domain is an ordinary name pointing at the node’s IP. The panel needs it for one more reason: the certificate is issued for it. The CDN reaches the origin over HTTPS and verifies that certificate.

  1. Add an A record, for example origin.example.com → the node’s IP.
  2. In the panel, open the node card and put that domain in the Domain field.
  3. Wait for the panel to issue the certificate (Nodes → the node card, certificate state).

Without a certificate the CDN fails to verify the origin and its log shows a TLS refusal.

The panel has two CDN presets — the choice depends on whether the provider passes POST.

  • VLESS · TLS · XHTTP · CDN: the stream-one mode — the uplink in a single POST, the downlink in a streaming GET. For CDNs with a living POST; the big ones cut it ever more often — Yandex blocks POST outright on its backend.
  • VLESS · TLS · XHTTP · CDN · GET uplink: the packet-up mode with the uplink in GET requests whose payload rides X-Data headers, the body empty. This passes where POST does not live. Clients need a fresh Xray (26.3.27+ inside Happ, v2RayTun) or mihomo (1.19.32+); sing-box apps never get this protocol.
  • Keep the offered port or change it: it is the CDN that faces the outside, not this port.
  • The certificate is the origin domain from step 1.

Then, in that inbound’s Behind a proxy block, put the address your clients will dial — that is, the distribution domain:

  • Address for clients: cdn.example.com
  • Port for clients: 443
  • SNI for clients: cdn.example.com

The subscription now hands clients the CDN’s address instead of the node’s.

The order differs between providers, but the meaning is the same:

  1. Create a resource with the origin origin.example.com (type: static or general HTTP).
  2. Attach the distribution domain cdn.example.com to it: the provider gives you a CNAME to put in DNS.
  3. Issue a certificate for the distribution domain — usually the provider does this itself.
  4. Make sure the provider does not rewrite the method or the body and passes POST through.

Step 4. What answers “ordinary” requests

Section titled “Step 4. What answers “ordinary” requests”

Sooner or later the CDN asks the origin for a path your transport does not have — and a scanner or the CDN itself will see that answer. So that the node does not look like an empty server, it has a page of its own (see Nodes): files in /opt/mikan/data/node/www on the node’s server, its own certificate, port 443 or 127.0.0.1:18443 when 443 belongs to an inbound.

Put your own index.html and 404.html there — the node never overwrites them. The node holds port 80 too: it answers ACME checks and sends everything else with a 301 to HTTPS, so http://origin.example.com leads to an ordinary website.

Do not change the XHTTP settings until every layer below them works. The order:

  1. Domains and certificates line up: origin.example.com points at the node, cdn.example.com at the CDN, both with a valid certificate.

  2. The origin answers over HTTPS directly, bypassing the CDN:

    curl -sv https://origin.example.com/ -o /dev/null
  3. The CDN gets an answer from the origin — visible in its log or console.

  4. A request to the transport path reaches the node.

  5. The client got a fresh subscription: it carries cdn.example.com.

Only then is it worth touching the mode, the padding and the other XHTTP fields.

One command can check the layers, using the script in the repository:

bash scripts/cdn-check.sh --cdn cdn.example.com --origin origin.example.com --path /your-path/

It changes nothing: it looks at the DNS of both names, the origin’s certificate (validity, names, issuer), the origin’s answer directly, the CDN’s answer and the response time at both ends, then sends a POST and a GET to the transport path. A failure names the layer, and that already shows what to fix. It also catches a 405 on POST: that is the answer to whether the CDN you picked passes a POST uplink — for the GET uplink it is no verdict, see the row above.

What you see Where to look
502 origin domain resolution, its port, TLS/SNI, the certificate, the Host header; the same request directly, without the CDN
504 the origin’s response time directly and through the CDN; some CDNs have a fixed window (Yandex wants an answer within five seconds) that raising a timeout in nginx will not change
403 access rules and the WAF on the CDN’s side
404 the Host header and the path: the request landed in the wrong handler
405 the method: CDNs often pass only GET, HEAD and OPTIONS. For the POST preset (stream-one) — change the CDN; for the GET uplink it is no verdict: its upload goes GET, see the row below
413 a body size limit: check it on every layer
429 rate and connection limits
Works, then freezes the CDN’s maximum connection duration and idle time, read timeouts; proxy_read_timeout sets the gap between read operations, not the length of the whole response
Works over Wi-Fi, not on mobile that proves a route exists, not that the CDN’s node is reachable on a given operator: try another node or another provider

If nginx already stands in front of the node

Section titled “If nginx already stands in front of the node”

Then the CDN arrives at nginx, and nginx routes by path: the transport path to the local XHTTP port, everything else to the node’s page. A template for the http block:

server {
listen 443 ssl;
server_name origin.example.com;
ssl_certificate /etc/letsencrypt/live/origin.example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/origin.example.com/privkey.pem;
# The transport path: use your own (the panel shows it on the inbound).
location /your-path/ {
proxy_pass http://127.0.0.1:11443;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_buffering off;
proxy_request_buffering off;
proxy_read_timeout 3600s;
proxy_send_timeout 3600s;
}
# Everything else is an ordinary website.
location / {
root /var/www/origin;
try_files $uri $uri/ =404;
}
}
  • It does not set the CDN up for you: the resource, the distribution domain and its certificate live in the provider’s console.
  • It does not issue a certificate for the distribution domain: that is the CDN’s side.
  • It does not guarantee a way through whitelists: the reachability of CDN nodes differs between operators and regions, and the outcome depends on the network.

The scheme needs attention: after changes at the CDN or in the core, the chain has to be checked again. For a service you can add load and cost estimates, connection limits, origin monitoring and a plan for replacing the CDN.