CasWAF
Sites

Sites

A site is one web application behind the gateway. Each request is matched to a site by its domain, and the site says where the request goes and what is checked on the way.

Domains

FieldWhat it does
DomainThe main domain, such as app.example.com
Other domainsMore domains served by the same site, such as example.com or app.example.net
Need redirect, Redirect with slashSend the other domains to the main one; see Redirects

Matching ignores case, the port and a leading www., so www.app.example.com:443 matches a site whose domain is app.example.com. A request for a domain no site has gets a 500 with CasWAF error: site not found for host, and a request whose Host is a bare IP address gets a 400.

Where requests go

CasWAF picks the upstream in this order:

FieldUsed whenExample
HostsIt has entries; one is picked at random for each requesthttp://10.0.0.11:8080, http://10.0.0.12:8080
HostHosts is emptyhttp://127.0.0.1:3000, https://backend.internal
PortBoth are empty3000 means http://localhost:3000

The original Host header is passed on unchanged, and CasWAF adds X-Real-Ip (the client address) and X-Forwarded-Proto (http or https). See Client IP behind a proxy for X-Forwarded-For.

Picking among Hosts is plain random choice: there is no weighting, and an upstream that is down is not taken out of the rotation.

Serving a folder

Set Mode to Static Folder and Host to a folder on the gateway machine, such as /var/www/site, and CasWAF serves the files in it. / serves index.htm or index.html. The other modes, HTTP, HTTPS and HTTP and HTTPS Only, are covered in HTTPS.

Status

StatusEffect
ActiveServed normally
InactiveStill served by the gateway, but skipped by health alerts
StoppedEvery request gets 503 and a page saying the service has been stopped

To take a site offline, set it to Stopped; to remove it, delete it.

Other fields

FieldWhat it does
Name, Display nameThe site's ID is <owner>/<name>; the owner is the account that created it
TagFree text; the site list is sorted by it
RulesThe rules checked for each request, in order
Disable verboseVisitors stopped by a rule see only "the rule has been hit" instead of the rule's reason
Casdoor appRequire visitors to sign in first; see Login protection
ChallengesAnswers for /.well-known/acme-challenge/<token> and /MP_verify_* files, written as token:answer; CasWAF fills these in itself for Let's Encrypt
Public IPFilled in from DNS: the first IPv4 address the main domain resolves to
SSL certRead only: the certificate the site's domain matches
NodeThe first gateway that served the site
NodesUsed by CasWAF's deployment of applications from Git, which today only handles Casbin's own projects (see the roadmap); leave it empty
Enable alert and the fields after itHealth alerts

Changes are picked up by every gateway within a few seconds of saving.

Edit on GitHub

On this page