nsindocs Search the docs⌘K
  1. Docs
  2. Rules

Origins & Failover

Spread traffic across several servers, fail over when one goes down, and send parts of your site to different backends.

On this page

Your origin is the server nsin fetches your site from — by default, whatever your DNS record points at. Two edge-side rule types change that:

  • Origin pool — several servers, with health checks and failover.
  • Origin route — send specific paths to a specific server.

Origin pools

  1. Go to Rules → Add Rule → Origin Pool.
  2. Add each server: address, port, http or https.
  3. Choose a method:
Method What it does
Round robin Rotates through servers. A higher weight gives one a larger share.
Least load Prefers the server currently handling the least work.
Geographic Each nsin location uses the server you assign it.
  1. Click Save.

Health checks

Turn this on and nsin probes each server (/ by default, or a dedicated /healthz), pulling failures out of rotation. Set the interval, timeout, failures to eject a server, and successes to bring it back. A server failing real requests can also be ejected for a short cool-off.

Origin routes

Sends matching paths to one server, leaves the rest alone.

  1. Go to Rules → Add Rule → Origin Route.
  2. Set the paths (for example /api/*).
  3. Set the server address, port, and scheme.
  4. Click Save.

Split the API off the website

  • /api/* → 10.0.0.20:8080 over http
  • everything else → your normal origin

The Host header

Both rule types let you override the host header (and TLS SNI) nsin sends to the origin — for a backend serving several sites. Empty sends the hostname the visitor asked for.

The name must be inside this domain or another active domain of the same account — so app.example.ir can send app.example.com when both domains are yours. The same rule applies to a record's Host header and to a pool's health-check host.

Common questions

Which rule do I want? Several identical servers → pool. Different parts on different servers → route. You can use both.

A server in my pool is down — what do visitors see? With health checks on, nothing: traffic moves to the others. Without them, some requests fail until you remove it. See Uptime for outage records.

Can I use hostnames instead of IP addresses? Yes, but nsin then depends on that name resolving correctly.

esc