Skip to Content
HostWall

Add a site

Protect a website or API with HostWall from the dashboard, the CLI or the config file, and check that it works.

A site is one website or API that HostWall protects. It has a domain (plus optional aliases such as www.), and an upstream: the address where your app listens.

Before you start

  • Point the domain's DNS at the HostWall server (an A record, and AAAA for IPv6). Check with dig +short example.com.
  • Make sure HostWall can reach your app, for example curl -i http://localhost:3000 on the server.

In the dashboard

Right after your first sign-in, HostWall shows Protect your first site. Later, use Sites → Add site.

  1. Domain: the address visitors use, such as shop.example.com. Add more hostnames under Aliases, comma separated.
  2. App address: where your app listens, such as localhost:3000 or http://10.0.0.5:8080.
  3. Check the connection. HostWall looks up the domain and tries to reach your app, and tells you what it finds.
  4. Choose protection: keep Monitor to start. It logs attacks without blocking anything.
  5. Optional Advanced settings: HTTPS, security headers, paranoia level and what happens if inspection fails. The defaults are right for most sites.
  6. Click Protect site (or Add site).

Changes apply immediately, without a restart. HostWall requests a certificate in the background; the Sites page shows its status.

With the CLI

sudo hostwall site add example.com --upstream localhost:3000 --alias www.example.com

New sites use defaults.mode (monitor) unless you pass --mode. See hostwall site.

In the config file

Add the site to /etc/hostwall/hostwall.yaml:

sites:
  - domain: example.com
    aliases: [www.example.com]
    upstream: http://localhost:3000

HostWall reloads the file within about 2 seconds. In the dashboard you can change a file site's mode and protection settings (stored on top of the file, with a reset); its domain, aliases, app address and HTTPS stay in the file. See File sites and dashboard sites.

Check that it works

  1. Open https://example.com. Plain http:// redirects to https:// once the certificate is ready, usually within a minute.

  2. Send a harmless test attack from your computer:

    curl -s -o /dev/null -w "%{http_code}\n" "https://example.com/?id=1%27%20OR%20%271%27%3D%271"

    In monitor mode you get your app's normal status (usually 200), and the request appears on the Attacks page as Would block.

  3. Make sure visitors can't skip HostWall: your app should listen on 127.0.0.1 only, or have its port firewalled.

Next: Monitor vs block mode.

Common upstreams

Your app runsUpstream
On the same serverlocalhost:3000
On another server in your networkhttp://10.0.0.5:8080
In Docker, next to HostWall's containerhttp://app:3000 (the service name)
On the Docker host, with HostWall in a containerhttp://host.docker.internal:3000
Behind HTTPS with a valid certificatehttps://app.internal
On several serversa list; requests are spread round-robin
Edit this page on GitHub

On this page