# Primary or Mirror: which host to use

> Both hosts serve the same API. When to switch, and how to fall back in your code.

2 min read · https://arena.rone.dev/guides/choose-a-host

## 1. The two hosts

Primary is https://arena.fastapicloud.dev/api and is the one to use by default. Mirror is https://arena.rone.dev/api. They run the same code and give the same answers.

## 2. When to switch

Switch when a request fails with a server error (500 or higher), times out, or returns a web page where you expected JSON. A 429 is a request to slow down: on the mirror, more than 50 requests in 10 seconds from one address gets one, so wait a few seconds. A 429 with the code UPSTREAM_RATE_LIMITED means the game service is busy: wait a few minutes instead of retrying quickly. Errors such as 404 or 422 mean the request itself is wrong, and the other host will say the same.

## 3. Fall back in code

Try the primary host first and the mirror second.

```
const HOSTS = ["https://arena.fastapicloud.dev/api", "https://arena.rone.dev/api"];

async function arena(path) {
  for (const base of HOSTS) {
    try {
      const res = await fetch(base + path);
      if (res.status < 500) return res.json();
    } catch {
      // network error: try the next host
    }
  }
  throw new Error("Both hosts failed");
}

const standings = await arena("/esports/id/standings");
```
