# Problems combining 'backup' command in upstream block with 'fair'-command

**URL:** <https://www.ruby-forum.com/t/problems-combining-backup-command-in-upstream-block-with-fair-command/235285>\
**Category:** NGINX\
**Created:** [June 11, 2013, 2:20pm UTC](https://www.ruby-forum.com/t/problems-combining-backup-command-in-upstream-block-with-fair-command/235285 "2013-06-11T14:20:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![alcina](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/a587f6/32.png) [@alcina](https://www.ruby-forum.com/u/alcina)\
**Post date:** [June 11, 2013, 2:20pm UTC](https://www.ruby-forum.com/t/problems-combining-backup-command-in-upstream-block-with-fair-command/235285/1 "2013-06-11T14:20:30Z")

</div>

Dear users,

My first message here; I discussed my issue already with some folks on  
IRC; my main conclusion was that I should try it with a broader  
audience. So here’s the problem:

- we’re using the ngx\_http\_upstream\_module, and  
ngx\_http\_upstream\_fair\_module together with the HttpProxyModule

- The ‘proxy’-configuration looks like this:  
location “/jvbnet/betsy/ip-vhost-trial/” {  
rewrite “^/jvbnet/betsy/ip-vhost-trial/(.\*)$” “/$1” break;  
proxy\_pass [http://0893697e3d3e9e1a78d79c5d3b13c258](http://0893697e3d3e9e1a78d79c5d3b13c258);  
proxy\_set\_header Host rd.devel.xxx-xxxxx.nl;  
proxy\_cache cache;  
}

- There is a separate configuration file defining the upstream:  
upstream 0893697e3d3e9e1a78d79c5d3b13c258 {  
server 172.17.88.10;  
server 172.17.88.20 backup;  
fair;  
}

- What I see:

- If no connection can be made to 172.17.88.10 (because I switched off  
Apache over there), no roll-over to 172.17.88.20 happens

- Next I remove the ‘fair’ command:  
upstream 0893697e3d3e9e1a78d79c5d3b13c258 {  
server 172.17.88.10;  
server 172.17.88.20 backup;  
}

- Now, in the same situation, nginx -does- rollover to 172.17.88.20, as  
I expected

- What I expected: nginx performing rollover in the first scenario

I get the same results if more non-backup servers are configured. And if  
I put ‘fair’ as the first command in the initial scenario:  
upstream 0893697e3d3e9e1a78d79c5d3b13c258 {  
fair;  
server 172.17.88.10;  
server 172.17.88.20 backup;  
}

the nginx configuration tester gives an error:  
nginx: [emerg] invalid parameter “backup”

To me it seems that the fair-module does not cooperate properly with the  
‘backup’ parameter. Did anyone else notice this problem, and if so, is  
there a workaround/solution? Are there other configuration issues I may  
have to check?

Sincerely,  
Jakob van Bethlehem

---

<div class="post-metadata">

**Author:** ![Jakob\_van\_Bethlehem](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/45deac/32.png) [@Jakob\_van\_Bethlehem](https://www.ruby-forum.com/u/Jakob_van_Bethlehem)\
**Post date:** [June 11, 2013, 2:56pm UTC](https://www.ruby-forum.com/t/problems-combining-backup-command-in-upstream-block-with-fair-command/235285/2 "2013-06-11T14:56:08Z")

</div>

Hello!

On Tue, Jun 11, 2013 at 02:19:46PM +0200, Jakob van Bethlehem wrote:

[…]

> To me it seems that the fair-module does not cooperate properly with the  
> ‘backup’ parameter. Did anyone else notice this problem, and if so, is there a  
> workaround/solution? Are there other configuration issues I may have to check?  
> The error message suggests that fair balancer isn’t able to work  
> with backup servers.

The error is only reported if a balancer is activated before  
“server” directives as the check in question only done when  
parsing “server” directives.

–  
Maxim D.

> **[nginx: donation](http://nginx.org/en/donation.html)**
