None of these needs a second proxy or a container restart. A change is stored, audited, and applied on the next ingress reconcile pass (normally within a second). Deleting a section restores the default behavior for that domain.
Where to find it
- Dashboard
- CLI
- API
On the Domains page, click a domain name. The domain page has tabs for Overview, Headers, Forwarding, Access, Cache, Redirects, Ports and Danger zone. The abuse shield moved to Firewall: select the host under Rules, or use the Firewall limits button on the domain page. Each editor keeps an unsaved draft per tab, shows the difference before you save, and a “rules preview” lists in order what happens to a sample request. The body cap and timeouts sit on the same page in their own block; see Domain traffic limits.
Order of evaluation
For a request to a domain with controls configured, the ingress runs, in order:- Abuse shield (allowlist, bad bots, body size, per-client rate and concurrency)
- Redirects (lower case host, force HTTPS, trailing slash)
- Geo rule
- Headers: request rules, CORS, then response rules and presets
- The existing WAF, rate limit and basic auth, if configured
- Cache lookup
- Forwarders, first match wins
- The domain’s own app
Where controls are enforced
Every control on this page runs in the built-in ingress. When a domain is served through another reverse proxy, the controls apply only if that proxy provably forwards to the ingress:
See behind an existing proxy for the full matrix and how to prove a route.
Headers
Rules are evaluated in order. Each rule has a side (request or response), an operation (set, add or remove), a name, and (except for remove) a value.
- Request rules change what the app receives.
- Response rules apply after the app answers, so they override the app’s own value. A later rule overrides an earlier one, and any rule overrides a preset.
- Header names must be valid RFC 9110 tokens. Values cannot contain line breaks or control characters, and are capped by
APP_DOMAIN_POLICY_MAX_HEADER_VALUE_LEN. Operator text is never expanded as a Caddy placeholder, so a value like{env.SECRET}is sent literally. - These names are reserved by the ingress and refused:
Host,Content-Length,Transfer-Encoding,Connection,Keep-Alive,Upgrade,TE,Trailer,Proxy-Connection,Forwarded,X-Real-IP,Proxy-Authorizationand everyX-Forwarded-*header.X-Forwarded-Prefixhas its own option,forwarded_prefix.X-CacheandCache-Statusare reserved for the cache.
Presets
HSTS is only accepted when the domain has a publicly trusted certificate: ACME enabled, an uploaded certificate, or TLS terminated by your own proxy. Sending HSTS with a self-signed certificate would lock visitors out, so the API refuses it. When the ingress terminates TLS, HSTS is only sent on HTTPS responses.
CORS echoes the request’s
Origin back only when it is in the list, and adds Vary: Origin. * allows any origin but cannot be combined with credentials.
Path forwarders
A forwarder sends requests that match a path somewhere other than the domain’s app. Rules are checked in order, the first match wins, and a request no rule matches goes to the app as usual.
An
app target uses the same upstream the app’s own domain routes to; if that app is not running, the rule answers 502 with a plain explanation rather than falling back to the default app.
Outbound safety
An external URL is resolved and every address it resolves to is checked, both when you save and again on every ingress pass (cached for a minute), so a DNS record changed later to point at an internal address is caught. Refused targets:- loopback, unless
APP_FORWARDER_ALLOW_LOOPBACK=true - private and carrier grade NAT ranges, unless
APP_FORWARDER_ALLOW_PRIVATE_NETWORKS=true - link-local and cloud metadata addresses (
169.254.0.0/16,fe80::/10,fd00:ec2::/32,100.100.100.200), always
502.
A forwarder to an external URL whose host is the domain itself is refused, and so is a redirect to a path the same rule would match again.
Geolocation
A geo rule is an allow list (only these countries) or a deny list (everyone but these) of ISO 3166-1 alpha-2 codes, plus what to do with a blocked visitor: a plain403 (or 404, 451), a redirect, or your own HTML page.
- Private, loopback and link-local addresses are never blocked by country.
- Addresses and ranges in
exemptalways pass. unknowndecides requests whose country cannot be determined:allow(default) orblock.
Country sources
The ingress needs a country source. Without one, geo rules are saved but inactive, and the dashboard andGET .../policies say so.
APP_GEOIP_SOURCE picks auto (default: the header when trusted proxies are configured, the database when it loads, header first), header, mmdb or none.
Two databases work out of the box:
- MaxMind GeoLite2 Country: free, but needs a MaxMind account and licence key to download, and its EULA applies (including keeping the file updated).
- DB-IP IP to Country Lite: free under CC BY 4.0, no account. Attribution is required wherever you show the data, for example “IP geolocation by DB-IP”.
oschwald/maxminddb-golang (ISC licence).
Check what a lookup returns:
Bot and abuse shield
A scraper or bot flood should not be able to run up your bandwidth or take an app down. The shield limits what one client can cost a domain, at the ingress, before the request reaches your app. It never shows a challenge page.
The shield’s body cap is a separate setting from the per-domain body cap. The per-domain cap and timeouts are described in Domain traffic limits.
Rate and concurrency rejections return
429 with Retry-After. Verifying good bots by reverse DNS is not part of the shield, so add search engine ranges to allow if you need them.
The bot denylist ships as data (internal/trafficpolicy/shield_bots.txt, shown in Firewall under Rules and by levelrail-cli domains shield bots). Point APP_SHIELD_BOT_LIST_FILE at your own file (one lower case fragment per line, # comments) to replace it; changes apply when the ingress config next reloads.
Under attack mode is one switch for an emergency. It clamps the rate, burst and concurrency to APP_SHIELD_ATTACK_RATE_PER_MINUTE, APP_SHIELD_ATTACK_BURST and APP_SHIELD_ATTACK_MAX_CONCURRENT (or keeps your limits when they are already tighter) and refuses listed bots. It works even when the shield is off, lasts APP_SHIELD_ATTACK_DEFAULT_DURATION unless you pass a duration (at most APP_SHIELD_ATTACK_MAX_DURATION), and ends on its own with no further action.
Defaults and the recommended limits
Nothing is limited until you ask: a domain has no shield by default, and an upgrade never adds one. Under attack mode works without a shield for emergencies only. For a quick start, the app’s Domains page has an Abuse protection card (andlevelrail-cli domains shield recommend <app>) that turns on a sensible per-visitor rate and concurrency limit, APP_SHIELD_RECOMMENDED_RATE_PER_MINUTE (600), APP_SHIELD_RECOMMENDED_BURST (100) and APP_SHIELD_RECOMMENDED_MAX_CONCURRENT (50). It follows three rules:
- It only touches domains with no shield row. A domain with any shield, even a disabled one, is left as it is.
- Bad bot blocking is a separate opt-in (
--block-bots), because the shipped list includes AI crawlers some owners want. - It refuses while a proxy (a Cloudflare proxied record or a TLS terminating proxy) hides client addresses and
APP_INGRESS_TRUSTED_PROXIESis empty, since every visitor would look like one client.
--dry-run, or the Preview button.
Client addresses live only in a per-domain in-memory table capped by APP_SHIELD_MAX_TRACKED_IPS (least recently seen evicted first). They are never logged or stored. Only counts by reason are kept, and the app Traffic tab, GET /api/v1/apps/{name}/traffic and levelrail-cli traffic show them as shield.
Caching
Caching is per domain and off by default. Each rule matches a path (prefix, exact or regex) and says how long to keep a response.- Only
GETandHEADare cached; aHEADcan be answered from a storedGET. - Never cached: requests with
Authorization, requests with aCookie(unless the rule setscache_with_cookies), range requests, upgrades, andCache-Control: no-storerequests. Responses withSet-Cookie,Cache-Control: private,no-storeorno-cache,Vary: *, aVaryon a header the rule does not list, a partial content range, or a status outside the rule’s list (default200). - TTL: the app’s
s-maxage, thenmax-age, then the rule’sttl_seconds. Withoverride_upstream, the rule’s TTL always wins. A TTL of 0 means “do not store”. TTLs are capped byAPP_INGRESS_CACHE_MAX_TTL. - Stale while revalidate: after an entry expires, the first request fetches a fresh copy from the app, and requests arriving while that fetch is running get the expired copy, marked
STALE, for up tostale_while_revalidate_seconds. - Key: the request host, path and query,
Accept-Encoding, and the rule’svaryheaders. Entries from one host are never served for another. - Every response on a cached path carries
X-Cache: HIT,MISS,STALEorBYPASS, and a hit has anAgeheader. A hit answersIf-None-MatchorIf-Modified-Sincewith304when the validators match. - More rule options:
never(do not cache these paths),stale_if_error_seconds,ignore_query_params,key_cookies(needscache_with_cookies). Purge also works by cache tag, and the Cache static assets preset adds a ready made rule. See CDN and caching.
APP_INGRESS_CACHE_MAX_BYTES (default 64 MiB) across every domain, with single responses capped by APP_INGRESS_CACHE_MAX_OBJECT_BYTES (default 2 MiB) or the domain’s own lower max_object_bytes. It is per instance, starts empty after a restart, and is not shared between nodes.
Redirects
Whole-domain redirects (one host to a target URL) still use domain redirects; the controls here build on them.Force HTTPS
How plain HTTP is handled depends on where TLS ends, and the Redirects tab says which case applies:
The redirect goes to the public HTTPS port (
public_https_port), so an internal port such as :8443 never leaks into a URL. The status is 308 by default, which keeps the method and body, or 301.
www and apex
Three presets: Redirect www to apex, Redirect apex to www, or Serve both. Choosing a redirect preset:- Adds the other host to the app if it is missing (this part needs the
writeability, like adding any domain), and shows the DNS record to create for it. - Installs a redirect from the non canonical host to the canonical one that keeps path and query.
replace to overwrite). A host in maintenance mode keeps answering 503 before any redirect, and the page warns about it.
Aliases
Pick one of the app’s domains as the primary and mark others as aliases: each alias redirects to the primary with path and query kept, using301, 302, 307 or 308. Domains you unmark stop redirecting to the primary.
Normalisation
- Trailing slash:
add(paths without a file extension get a slash),remove, oroff(default). Uses308. - Lower case host: redirects
Example.COMtoexample.com. Off by default.
http://www.example.com/a?x=1, http://example.com/a and https://www.example.com/a through your settings and shows each hop with its status code before you save.
Ports
Raw TCP and UDP port forwards are app streams (raw TCP streams); the Ports tab anddomains ports show list them for the domain’s app with their target, who may reach them, and conflicts: another stream on the same port, the HTTP ingress port, or a container that already publishes the port.
“Open this port only to these IPs” writes firewall rules: one allow rule per address or range, then a deny for everyone else, all labelled domain-ports:PORT/PROTO. Removing the restriction deletes exactly those rules.
Limits
Every cap has a default and an environment override on the control plane.Domain traffic limits
A domain can have its own request body cap and its own upstream read and write timeouts. They override the app and instance values for that domain only. Leave a field at 0 to keep the app or instance value.
The body ceiling defaults to 1 GiB and the timeout ceiling to 3600 seconds. Both come from the runtime settings
domains.limits_max_body_bytes and domains.limits_max_timeout_seconds, seeded by APP_DOMAIN_LIMITS_MAX_BODY_BYTES and APP_DOMAIN_LIMITS_MAX_TIMEOUT_SECONDS. A value above a ceiling is refused with 400 and the message names the limit. Lowering a ceiling also tightens limits already stored.
The timeouts apply to the main upstream, not to path forwarders. A read timeout shorter than a WebSocket’s idle period will cut that connection. The limits apply to app and standalone proxy domains only. A redirect-only or maintenance-mode domain renders no proxy route, so its limits do nothing there. Changes apply on the next ingress reconcile pass.
On the domain page, the Traffic limits block has three fields. The body cap is entered in MB, and the timeouts in seconds. Save stays disabled until a value changes or while a field is invalid. Reset appears once the domain has its own limits and removes them.
set changes only the flags you pass, and 0 clears one value. clear goes back to the app and instance values.
{"max_body_bytes": 104857600, "read_timeout_seconds": 120, "write_timeout_seconds": 120}. The response is the stored limits, with the current ceilings and the minimum body size, so a client can show the same bounds the dashboard does.
Status: built and covered by unit tests for the API, the CLI and the dashboard control. Body cap proven on a real host (arm64 Ubuntu VM, 2026-11-08): a request over the cap answered 413 when the application read the body, and the cap is enforced only when the application reads the body. Timeouts have no real-host run, and the dashboard control has not been checked in a browser at narrow or wide widths.
Permissions and audit
On the domain page, a user whose role lacks
deploy sees the TLS, redirect and more options cards disabled. A single line above them says: “You have read-only access. Ask an admin for deploy access to change these settings.” The Danger zone is outside that block and is not affected. The page only disables the controls. The API still checks deploy on every write, so a request sent straight to the API is refused.
Status: built and unit tested for the disabled state. Not checked in a browser as a viewer or an admin at narrow or wide widths.
Every change is recorded in the audit log like any other API write.
Next steps
Domains and ingress
TLS, WAF, maintenance mode and the rest of the ingress.
Load balancing
Balance traffic across an app’s replicas.