Behind a CDN
Weik.io 2026.2Put the names of your Weik.io installation behind Cloudflare's proxy and keep each caller's address in the audit trail.
On this page
A CDN such as Cloudflare can proxy any of the names of your Weik.io installation:
- The backend’s name
- The published leaf address
- The gateway hostnames
The agents’ links then go through the CDN too. Behind the CDN, requests reach the hub from the CDN’s addresses, but the CDN sends each caller’s own address in a header.
Trust the CDN’s header#
Cloudflare sends the caller’s address in CF-Connecting-IP. The terminator and the gateway accept that header only from the ranges in WEIKIO_EDGE_RANGES and remove it from every other request. That way, no one outside the CDN can choose the address that the audit trail records and the sign-in limit counts.
.env has Cloudflare’s published ranges and the date of that list on a commented line. When you proxy the names, uncomment that line in place of the empty WEIKIO_EDGE_RANGES= and run:
$ docker compose up -dIf you don’t proxy the names, leave the line empty.
Weik.io doesn’t fetch the list for you, so compare it with https://www.cloudflare.com/ips/ and update the line when Cloudflare changes its ranges. A request from an address outside the list still works, and counts as coming from the address it connected from.
Another CDN works the same way if it passes the caller’s address as Cloudflare does:
- It sets
CF-Connecting-IPto the caller’s address, replacing any value the caller sent. - It adds the caller’s address at the end of
X-Forwarded-For.
The terminator removes any X-Real-Ip that a caller sends through the CDN.
The hub’s allowed networks match the same address, the caller’s address from the CDN. Put the CDN’s ranges in WEIKIO_EDGE_RANGES and never on the allowed networks. If an allowed network contains one of them, every caller that comes through the CDN gets in.
Certificates behind a CDN#
A proxied name doesn’t point at the hub, so Let’s Encrypt can’t check it over port 443. Get its certificate another way, as Certificates describes. To get it through DNS, add a DNS connection for the zone. To use the CDN’s origin certificate instead, upload it on Settings › Platform › Installation.
Before its first certificate is issued, the hub serves a temporary one. If the CDN’s check of that certificate fails, give the origin certificate to the first init with --hub-certificate.
While the hub is unreachable#
Set the CDN to answer with a status from 502 to 504 while the hub can’t be reached. Agents send their telemetry to the backend’s name, so it goes through the CDN when the names are proxied. An agent keeps a batch that gets one of those statuses and sends it again later.
An agent discards a batch that gets any other status. If the CDN answers with a 404, or with a status in the 520s as some CDNs do for a server they can’t reach, the telemetry the agents send in the meantime is lost.
Sign-in limits#
The terminator limits sign-in attempts from each caller’s address, as the CDN sends it, to a burst of 5 and then 10 a minute. An attempt over the limit gets 429 with Retry-After: 6 and the sentence Too many sign-in attempts from this address. Retry after 6 seconds.
Uploads in parts#
A CDN caps the body of one request. Cloudflare’s cap depends on the plan the names are on:
| Plan | Cap on one request |
|---|---|
| Free and Pro | 100 MB |
| Business | 200 MB |
| Enterprise | 500 MB |
The weikio CLI uploads each file of an integration larger than 32 MiB (33,554,432 bytes) in parts of that size, one request each, so a large jar in libs/ or a big mapping file stays under the cap. The part size is the backend setting Weikio__Api__BlobChunkBytes. Keep it under the cap of your plan.
When an upload is interrupted, the CLI resumes it and sends only what hasn’t arrived. The terminator sets no body limit and allows a request 600 seconds, so a part still arrives over a link as slow as 0.5 Mbit/s.