Posted to openbsd by Bradipo at Mon Dec 12 22:11:06 GMT 2022view pretty

ext_addr="192.168.2.1"
ext_if="em1"
be1="192.168.1.2"
be2="192.168.1.3"
be3="192.168.1.4"

log state changes
timeout 3000

table <backend> { $be1 $be2 $be3 }


http protocol "backend" {
        match header set "X-Forwarded-For" value "$REMOTE_ADDR"
        match header set "X-Forwarded-By" value "$SERVER_ADDR:$SERVER_PORT"
        match header set "Keep-Alive" value "$TIMEOUT"
        pass
        tls keypair "relayd"
}

relay "betls" {
        listen on $ext_addr port https tls
        protocol "backend"
        forward to <backend> port https mode loadbalance check script "/usr/local/bin/checkbackend.sh"
}


# relayctl show summary
Id      Type            Name                            Avlblty Status
1       relay           sgtls                                   active
1       table           backend:443                             active (3 hosts)
1       host            192.168.1.2                     100.00% up
2       host            192.168.1.3                     100.00% up
3       host            192.168.1.4                     100.00% up