All help articles

Ingress: your host names on your own servers

On this page

The ingress is a shared front door for your websites and apps. You point a host name (such as www.example.com) at it, and it passes each request to a pool of your own servers: over HTTP, HTTPS, WebSockets, gRPC, FastCGI, SCGI or uWSGI. It gets the name's certificate for you. A server that stops answering is taken out of the pool until it answers again.

It is on the account page under Compute → Ingress, for an organization's owners and admins.

Who can use it

Each of your organization's servers whose plan includes Ingress brings a number of sites (the plan says how many; five unless your plan says otherwise). The page shows how many you have and how many you may add. If none of your servers' plans include it, ask support.

Adding a site

  1. Type the host name and choose Add a site. Names are two labels or more (example.com, www.example.com); use punycode (xn--…) for letters outside a–z. Wildcards are not taken.
  2. Prove the name is yours. Add the TXT record the page shows, at _zappocity-ingress. followed by your name, then choose Check the record. If your domain's DNS is on dnso.city in the same organization, the record is added for you, the page says so, and the site proves itself within a few minutes of the record showing (your domain must use dnso.city's name servers), with nothing to press. Keep the record afterwards.
  3. Point the name at the ingress. Add a CNAME record to the target the page shows, or A and AAAA records with its addresses. For a domain's bare name (example.com), where a CNAME is not allowed, use the A and AAAA records.
  4. Add your servers to its pool (below).

A site is served once it is proved and switched on. Turn off stops serving it without losing its settings; Remove deletes it.

When someone else proves your name

Whoever proves a name last serves it. If the name moves to another organization (say you sold the domain) and they prove it, your site for it stops being served, and your organization's activity says so. To take it back, prove it again: that is why the record should stay.

The pool

A pool is the servers a site's requests go to. Each entry is:

A pool has at most 16 entries. Your server's firewall must let the ingress hosts in on that port.

For a FastCGI pool, set the Document root: where your site's files are on your servers (/var/www/html unless you change it). The ingress asks PHP-FPM for the script at that root plus the request's path, so it must be the same path on every server in the pool. A request whose path names no .php script goes to /index.php (as most PHP frameworks expect), with the path asked for in REQUEST_URI. PHP-FPM doesn't serve images, stylesheets and other files, so serve those from a site with an HTTP pool (or a web server in front of PHP-FPM).

An SCGI or uWSGI pool gets every request as it was asked for: the app is at the root of the name (SCRIPT_NAME empty, the path in PATH_INFO). A request body of unknown length (sent in chunks) is read first, up to 8 MB. Headers whose names have an underscore aren't passed on, as the app couldn't tell them from the ones the ingress sets.

Pick by is how each request chooses a server:

Round robineach in turn
Fewest connectionsthe one with the fewest requests open
Same client, same serverby the visitor's address, so a visitor keeps to one server
First healthy (failover)the first in the list while it answers, then the next
Round robin by weightin turn, in proportion to the weights

Private networks

A pool can use your servers' addresses on one of your private networks, so your apps need not listen on a public address at all.

  1. Under Compute → Addresses & networks, choose Let the ingress in on the network. It needs a server on it first, which sets its location. Each ingress host in that location takes an address at the top of the network's range (10.0.0.254 on a /24, then 10.0.0.253, and the IPv6 addresses at the same places in the /64). Those addresses are shown on the network, and no server can be given them.
  2. On the Ingress tab, the network's servers' addresses appear in the list for each pool, with the network's name. Add them as you would public ones.
  3. Let the ingress's addresses in through your servers' firewalls on the app's port.

A site whose pool is on a private network is served only by the ingress hosts in that location, so its page shows the name and addresses to point it at in place of the shared ones. A pool's private networks are all in one location; it can also hold public addresses.

Your network stays your own. The ingress keeps each network apart from every other customer's (they may use the same addresses as yours) and from the internet. It only opens connections to your servers and never routes traffic between networks.

Take the ingress off once no site's pool uses the network. It leaves by itself when the network's last server does; let it in again afterwards.

Health checks

Without an active check, a server that fails requests is set aside for a short while (a passive check: three failed requests set it aside for 30 seconds), and a request a server can't take is tried on another. With one, every ingress host checks each server on a schedule and takes it out of the pool when it fails:

It runs every 30 seconds unless you choose otherwise (5 to 3600), with a timeout of 5 seconds; two passes bring a server back and three failures take it out (both settable over the API). Each server in the pool shows healthy or down with the reason, as the hosts report it.

Firewall

Every site has a web application firewall: the OWASP Core Rule Set (run by Coraza on the ingress), which looks for SQL injection, cross-site scripting, path traversal, scanners and other attacks before a request reaches your servers. Open Firewall under the site:

Requests to /.well-known/ are never checked, so certificates can always be issued. A request body is checked up to 13 MB; a larger one is checked that far and passed on. If our staff add rules for your site, the page says so.

Browser check

A site can ask visitors' browsers to solve a small puzzle before they reach it: a "Checking your browser" page that takes a phone about a second, once. A bot sending many requests has to solve one for every network it comes from, which slows floods down a lot. Open Browser check under the site:

The page needs JavaScript and a current browser. A form submitted before passing has to be sent again after the check.

Caching

The ingress can keep pages and files your servers mark as cacheable and answer from there, which is faster for visitors and spares your servers. Open Caching under the site:

Each answer says where it came from in X-Zappocity-Cache: HIT (from the cache), STALE (out of date while refreshing), MISS (from your servers) or BYPASS (not cacheable, such as with cookies). Each ingress host keeps its own cache, in memory or on its disk.

Purging by tag

Your servers can label answers with a Cache-Tag header, several tags separated by commas:

Cache-Tag: product-42, catalogue

Then purge by tag (choose it beside Purge, or send {"tags": ["product-42"]} to the purge API) to empty every answer labelled with any of up to 30 tags, wherever it is on the site: a product's page, its pictures and the lists it appears in, say. Tags are 1 to 1024 printable characters without spaces or commas, and upper and lower case count as the same. An answer keeps at most 64. The ingress keeps the header to itself: visitors never see it.

How well it caches

With Standard caching on, Caching shows the figures the ingress hosts report (every 30 seconds):

They are summed over the hosts that reported in the last 3 minutes. Requests that bypass the cache (with cookies or a login, or not GET or HEAD) aren't counted. The figures are in the API too, as cacheFigures on each site.

Passing TLS through

Normally the ingress ends each visitor's TLS itself: it holds the name's certificate, reads the request, and applies the firewall, browser check and cache before passing it on. Under the site's TLS, choose Pass TLS through to my servers to keep TLS end to end instead. The ingress then reads only the name the visitor asks for (the TLS hello's server name) and relays the still-encrypted connection to a healthy server of the pool; your servers hold the certificate and the key, and the ingress never sees what visitors send.

For that:

Two settings go with it:

Switch back to Terminate at the ingress at any time; the ingress gets the name's certificate again within a few minutes.

Your servers' settings

Your servers see connections from the ingress, not from your visitors. Each site's Your servers section shows, for nginx and Apache, the settings that give them the visitor's address, filled in with the site's own name, ports and the ingress's addresses:

For Apache it shows both the site's virtual host (the main configuration) and .htaccess. Apache allows mod_remoteip and the PROXY protocol only in the main configuration, so the visitor's address can't be set in .htaccess. What .htaccess can do is set HTTPS from X-Forwarded-Proto, and redirect to HTTPS without looping: behind the ingress, test %{HTTP:X-Forwarded-Proto}, not %{HTTPS}.

A FastCGI, SCGI or uWSGI pool has no web server in between: the ingress gives the app the visitor's address as REMOTE_ADDR and sets HTTPS, so there is nothing to set up.

The addresses listed are the ones the ingress connects from: its own on the private networks your pool is on, and its public ones otherwise. Trust only those: anyone else trusted could claim to be any visitor.

Behind Cloudflare

If you use Cloudflare's proxy in front of a site, open Arrival under the site and choose Through Cloudflare. Then:

  1. In Cloudflare's DNS, point the name at the ingress (the CNAME or the A and AAAA records shown at the top of the page) with the proxy on (the orange cloud).
  2. Set Cloudflare's SSL/TLS encryption mode to Full (strict). The ingress makes its own certificate for the name as usual, through Cloudflare.
  3. Keep the _zappocity-ingress proof record. Cloudflare doesn't proxy TXT records, so the proof still works.

From then on only Cloudflare's addresses may connect for the name, so nobody reaches your site around Cloudflare (anyone else gets 403). Your servers, the firewall and the logs see each visitor's own address, from Cloudflare's CF-Connecting-IP, in X-Forwarded-For (and REMOTE_ADDR for FastCGI, SCGI and uWSGI).

The ingress's browser check can't be on for a site behind Cloudflare: use Cloudflare's own challenge (Under Attack mode or a challenge rule). The firewall and caching work as before.

Cloudflare's Origin CA certificate

The ingress gets a Let's Encrypt certificate for the name by itself, which Full (strict) accepts. To use Cloudflare's own Origin CA certificate instead, the ingress can have it issued for you:

  1. In Cloudflare, under My Profile, API Tokens, create a token with the permission Zone, SSL and Certificates, Edit, for the zone the name is in.
  2. Under the site's Origin certificate, paste the token and Issue it with Cloudflare.

The ingress makes a new key, asks Cloudflare's Origin CA for a one-year certificate for the name, and checks what comes back. It keeps the token encrypted, sends it only to Cloudflare's API, and renews the certificate 30 days before it runs out. If a renewal fails (the token revoked, say), it's noted in your organization's activity and your organization's owners and admins are emailed, and the certificate keeps working until it runs out. With your organization's token, choose Issue it with your organization's token instead of pasting one. Stop renewing forgets the token and keeps the certificate.

Or make one yourself (in Cloudflare: SSL/TLS, Origin Server, Create Certificate) and paste the certificate and its private key under Origin certificate. The certificate has to name the site (a wildcard such as *.example.com is fine) and be valid. The key is kept encrypted and never shown again. The page shows when it runs out: paste a new one before then, because once it has run out the site isn't served; 30 days before, a note is also left in your organization's activity and its owners and admins are emailed. Pasting a certificate stops any renewing. Use a Let's Encrypt certificate instead goes back.

An Origin CA certificate is only trusted by Cloudflare, so this is only possible while the site is behind Cloudflare.

One Cloudflare token for every site

Rather than a token for each site, give your organization one: open Cloudflare token above your sites, paste a token and Keep it. Each site can then use it, with Issue it with your organization's token under its Origin certificate, or Make it with your organization's token for a tunnel. A new token there is used by every site that uses it from then on, so a token you roll in Cloudflare is given once. Give it the permissions of everything your sites use it for: Zone, SSL and Certificates, Edit for certificates, and Account, Cloudflare Tunnel, Edit with Zone, DNS, Edit for tunnels, for each zone. It is kept encrypted, sent only to Cloudflare and never shown again; the box says who set it, when, and how many sites use it. Forget it leaves those sites unable to renew, which they then say (by mail too) until you give a token again.

Authenticated origin pulls

With authenticated origin pulls, Cloudflare shows a client certificate when it connects, and the ingress refuses every connection for the name without it. Turn it on in Cloudflare first (SSL/TLS, Origin Server, Authenticated Origin Pulls), then under Authenticated origin pulls choose:

Plain HTTP is refused for the name while pulls are on.

Through a Cloudflare Tunnel

With a Cloudflare Tunnel, the ingress connects out to Cloudflare for your site instead of Cloudflare connecting in. The name is then not served on the ingress's public addresses at all: only through your tunnel.

The ingress can make the tunnel for you:

  1. In Cloudflare, under My Profile, API Tokens, create a token with Account, Cloudflare Tunnel, Edit and Zone, DNS, Edit for the zone the name is in.
  2. Remove any A or AAAA records for the name in Cloudflare (a CNAME is fine: it's changed to point at the tunnel).
  3. Open Arrival under the site, choose Through a Cloudflare Tunnel, paste the token under Have the ingress make it and save (or, with your organization's token, Make it with your organization's token).

The ingress finds the name's zone, makes a tunnel, points its public hostname for the name at your site, and makes the name's proxied CNAME to it. If a step fails, the new tunnel is taken away again and the reason shown. The token is kept encrypted and sent only to Cloudflare; the ingress uses it to read the tunnel's state every 5 minutes, shown beside the tunnel (connected, with how many connections, degraded, down or not connected yet). Keep the _zappocity-ingress proof record. When you stop using the tunnel, it stays in your Cloudflare account: delete it, and the name's CNAME, there.

Or make the tunnel yourself:

  1. In Cloudflare's dashboard (Zero Trust, Networks, Tunnels), create a tunnel of type Cloudflared and copy its token (the long string after --token in the install command). cloudflared tunnel token NAME prints it too.
  2. Open Arrival under the site, choose Through a Cloudflare Tunnel, paste the token and save. The token is kept encrypted and never shown again; the page shows the tunnel's id and a service address, such as http://169.254.192.5.
  3. In the tunnel's Public hostnames, add the site's name with that service (type HTTP). Cloudflare makes the name's DNS record for you.
  4. Keep the _zappocity-ingress proof record: the ingress still checks the name is yours.

Every ingress host runs your tunnel, so Cloudflare spreads visitors over them and keeps working if one stops. Beside the tunnel, the page shows what the hosts say of it, for a tunnel you made too: connected on 3 hosts (12 connections), connected on 2 of 3 hosts when some can't reach Cloudflare, or not connected on any (check the token, and that the tunnel still exists in Cloudflare). Each host asks its own cloudflared at every check-in, about once a minute. Each tunnel runs boxed in on its own: it can reach only your site and Cloudflare, so whatever the tunnel's settings in Cloudflare say, it can't reach anyone else's site or the hosts themselves. Point the public hostname at the service shown, not at your own servers' addresses: those are the site's pool.

Your servers, the firewall and the logs see each visitor's own address (Cloudflare's CF-Connecting-IP). As behind Cloudflare's proxy, the browser check can't be on; and Cloudflare makes the certificate, so the site has no origin certificate or origin pulls.

To stop using the tunnel, choose another arrival and save, then Forget the tunnel. A new token (after you rotate it in Cloudflare) can be pasted at any time; the service address stays the same.

For a site reached directly, the ingress drops any CF-Connecting-IP or True-Client-IP header a visitor sends, so your servers can't be fooled into trusting a made-up address.

A dedicated address

A site normally shares the ingress's public addresses with everyone else's. Your organization can instead take an address of its own and serve sites on it, for a firewall rule or allow-list that names one address, or a client that can't send the name (no SNI).

  1. Under Dedicated addresses in your organization's ingress, choose Take a dedicated address. Its price a month is shown first; it's charged from today, on your organization's invoice. Only owners and billing members can take or release one; admins see them.
  2. Under the site, set Served on to the address.
  3. Point the name's A (or AAAA, for an IPv6 address) record at that address, not at the shared ones or the CNAME target.

A site on its own address is served there and only there: the shared addresses answer 421 for it, and your address answers only your sites on it. An address may belong to one location, the ingress hosts there serving it (its location is shown beside it). An organization can hold up to 8.

Release stops the charge. The address stays yours until the end of the month you've paid for, then goes, and its sites move back to the shared addresses (change their records before then). Keep it takes a release back while it lasts. A site reached through a Cloudflare Tunnel has no address, so it can't be put on one.

Reverse DNS

A dedicated address can have a reverse DNS name (its PTR record), for mail servers and others that check it. First give the name an A (or AAAA) record pointing at the address, then type the name under the address's Reverse DNS and Save. The name must already resolve to the address, so nobody can name an address after a domain they don't control. Clear the box and save to remove it; the name also goes when the address goes. Owners and admins can set it. Where the box isn't shown, reverse DNS isn't offered for the address yet.

Raw TCP and UDP

A dedicated address can also carry other protocols than the web: SSH, a game server, a database, DNS. Under the address, choose TCP or UDP, the port on the address, one of your servers and the port there, and Add. Within about 30 seconds every ingress host serving the address forwards that port to your server. Owners and admins can add and remove forwards.

Raw TCP and UDP are never offered on the shared addresses, where one customer's port would clash with another's.

Mail

A site's name can also take mail for your own mail server: your users' mail apps, and (on a dedicated address) other mail servers delivering to you. Open the site's Mail, choose your mail server and what to take, and Save mail:

PortNeeds
Incoming mail (SMTP)25the site on a dedicated address
Sending (submission)587 (STARTTLS) and 465 (TLS)
IMAP143 (STARTTLS) and 993 (TLS)
POP3110 (STARTTLS) and 995 (TLS)
Filters (ManageSieve)4190 (STARTTLS)

The ingress answers those ports for the name, with the name's own certificate, so mail apps need no exceptions. It then passes each connection on to your server over TLS:

Your server's own certificate isn't checked, so a self-signed one is fine. Each connection starts with a PROXY protocol (version 2) header giving the client's address, so turn that on for these ports on your server, accepting it only from the ingress hosts:

To use other ports on your server, set them over the API.

Several mail servers

Add more mail servers under Your mail servers (up to 8) and the ingress tries them in order: when the first doesn't answer, the next takes the connection. Turn on Check them and every host connects to each port of each server every 10 seconds. A server found down three times in a row is tried after the others until it answers twice. If every server is down, every one is still tried. Each server shows whether the hosts find it up, and why not.

A mail server can also be on one of your private networks with the ingress let in: choose its address there. The site is then served only by that network's location. Its pool's private networks and its dedicated address must be in the same location.

Mail routed by the mailbox

With several servers, each can list the mailboxes it holds under Holds: addresses (amy@example.com) or whole domains (@example.com), separated by commas. Each can be listed by one server only. Then for IMAP, POP3 and sending (submission) the ingress waits for the mail app to sign in and takes the connection to the server holding that mailbox:

  1. the servers listing the exact address;
  2. otherwise those listing its domain;
  3. otherwise those listing nothing.

Within those, servers are still tried in order and checked as above. The ingress signs in to your server as the app did: IMAP with LOGIN, POP3 with USER and PASS, sending with AUTH PLAIN. Your server must offer AUTH PLAIN after TLS on its submission port. The password is only passed on, never kept or logged. Someone whose mailbox no server holds is refused as if the password were wrong. On IMAP and POP3, so is a sign-in on behalf of another mailbox.

Filters (ManageSieve) and incoming mail on port 25 aren't routed this way: they go to your servers in order.

Mail apps must use TLS (or STARTTLS) before signing in; the ingress refuses anything else first. Other mail servers may deliver to port 25 without TLS, as some still do; that part is passed on to your server over TLS all the same.

Incoming mail needs a dedicated address, as many sending servers don't say which name they want, so on the shared addresses the ingress couldn't tell whose mail it is. Point your domain's MX record at the site's name, whose A (and AAAA) record is the dedicated address. Set the address's reverse DNS to the same name too, as receiving servers check it. On a dedicated address, a port mail answers can't also be a raw TCP forward.

Mail doesn't go through Cloudflare, so it is only for a site reached directly. Point mail apps at the site's name.

Over the API

Everything on the page is in the account API (api/account.yaml, the Ingress tag): GET and POST /api/account/orgs/{orgId}/ingress, and under each site PATCH, DELETE, PUT …/backends and POST …/verify. The firewall is the waf object of the site's PATCH, the browser check its challenge, caching its cache, how visitors arrive its arrival (direct, cloudflare or tunnel), its tunnel's token tunnel (token), its own certificate certificate (cert and key), an Origin CA certificate issued and renewed with your Cloudflare token originCA (token), and origin pulls pulls (mode and ca), with orgToken in originCA or tunnel for your organization's token (PUT and DELETE …/ingress/cloudflare), and POST …/purge empties the cache. tls (terminate or passthrough) is where its TLS ends, with passthrough (proxyProtocol, httpPort). A site's ip puts it on a dedicated address; POST …/ingress/ips takes one (family 4 or 6) and POST …/ingress/ips/{address}/release releases it (keep takes the release back). POST …/ingress/forwards adds a raw TCP or UDP forward (ip, protocol, port, address or targets, backendPort, proxyProtocol, policy, check), PATCH …/ingress/forwards/{forwardId} changes its servers (targets, each address and network), policy (round_robin or first) or check, and DELETE …/ingress/forwards/{forwardId} removes one; PUT …/ingress/ips/{address}/ptr (hostname) sets an address's reverse DNS name. PUT …/{siteId}/mail sets a site's mail (address, protocols from smtp, submission, imap, pop3 and sieve, and ports for your server's when not the usual, servers for several, each address and network, and check); no protocols turn it off. The site's mailHealth is what the hosts find of each server.

Coming next

Firewall events on the page and more kinds of health check are planned.

Back to top