# Failover / backup server functionality

**URL:** <https://community.traefik.io/t/failover-backup-server-functionality/2891>\
**Category:** Traefik v1\
**Tags:** file\
**Created:** [November 11, 2019, 4:52pm UTC](https://community.traefik.io/t/failover-backup-server-functionality/2891 "2019-11-11T16:52:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![skrobul](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/skrobul/32/1090_2.png) [@skrobul](https://community.traefik.io/u/skrobul)\
**Post date:** [November 11, 2019, 4:52pm UTC](https://community.traefik.io/t/failover-backup-server-functionality/2891/1 "2019-11-11T16:52:21Z")

</div>

Hi there,

I am trying to implement a relatively simple HTTP loadbalancing scenario with Master/Backup failover:

- two "backend" servers - let's say A and B
- server A should receive 100% of incoming traffic. If server A fails healthcheck, the traffic should be served from server B
- server B should not receive ANY traffic as long as server A is up

Is there any way to achieve this functionality with traefik?

Things I have tried so far:

- creating two frontends/routers, with exact same matchers and defining higher priority on a frontend referring to backend with server A. This worked when server "A" was online, but produced 503 error when it became unavailable

For reference, the config was as follows:

```auto
[file]

[backends]
    [backends.primary]
      [backends.primary.servers]
        [backends.primary.servers.server0]
        url = "https://1.1.1.1:1111"
      [backends.primary.healthCheck]
      path = "/"
      interval = "10s"

    [backends.backup]
      [backends.backup.servers]
        [backends.backup.servers.server0]
        url = "https://2.2.2.2:2222"
      [backends.backup.healthCheck]
      path = "/"
      interval = "10s"

[frontends]
  [frontends.api-frontend]
    entryPoints = ["http", "https"]
    backend = "primary"
    passHostHeader = true
    priority = 200

  [frontends.api-frontend.routes]
    [frontends.api-frontend.routes.route0]
        rule = "Host:my.example.com"

  [frontends.api-frontend-backup]
    entryPoints = ["http", "https"]
    backend = "backup"
    passHostHeader = true
    priority = 100

  [frontends.api-frontend-backup.routes]
    [frontends.api-frontend-backup.routes.route0]
        rule = "Host:my.example.com"

```

- creating single frontend with a backend containing two servers A & B. In one of the issues on Github I found that setting weight of a server to 0 will make it a "backup" server, which is exactly what I need (at least it was in HAproxy terminology).  
Unfortunately this was not supported by documentation and if I understand correctly, this simply disables the server.

Config was something like that:

```auto
[file]

[backends]
    [backends.primary]
      [backends.primary.servers]
        [backends.primary.servers.server0]
        url = "https://1.1.1.1:1111"
        [backends.primary.servers.server1]
        url = "https://2.2.2.2:2222"
        weight = 0
      [backends.primary.healthCheck]
      path = "/"
      interval = "10s"

[frontends]
  [frontends.api-frontend]
    entryPoints = ["http", "https"]
    backend = "primary"
    passHostHeader = true

  [frontends.api-frontend.routes]
    [frontends.api-frontend.routes.route0]
        rule = "Host:my.example.com"

```

I was searching through this forum and Github issues to find possible solutions but came up empty. The closest I found was [PR#3072](https://github.com/containous/traefik/pull/3072) but looks like it wasn't merged.

Any ideas?
