4

Let's say I have an HTTP configuration block like so:

listen testing
  bind 1.2.3.4:80
  balance roundrobin
  use-server server1 if { urlp_val(force) eq 1 }
  use-server server2 if { urlp_val(force) eq 2 }
  force-persist if { urlp(offline) -m bool }
  cookie SRVID insert indirect nocache
  server server1 1.2.3.5:9000 cookie 1
  server server2 1.2.3.6:9000 cookie 2

Then, at some point, I disable server2 via the socket interface so that all connections to it are now forced over to server1. But server2 isn't really offline, it is just undergoing maintenance and it should be checked before being re-enabled. So requesting http://1.2.3.4/?force=2&offline=true should be proxied to server2. But that's not happening, it's being proxied to server1.

If I add option persist then persistence will stay and no one will be directed to server1 since server2 wasn't really unavailable.

How can I accomplish my goal of stopping automatically load balanced traffic from going to server2 but force conditional traffic to it when it is disabled?

James Sumners
  • 513
  • 3
  • 7
  • 17
  • 1
    I believe `option redispatch` is what you're looking for in conjunction with `option persist` – alzee Dec 17 '15 at 22:14
  • @user3137702 that's only if the backend server is actually offline, not just disabled – James Sumners Dec 18 '15 at 02:05
  • Ah that's right, and I didn't notice your `force-persist` either. I think you may want to get rid of that directive, and use `option httpchk` which can check a specific url, e.g. `/downForMaint` and have your "maintenance mode" server return a 4xx or 5xx on that URI if it is down. – alzee Dec 18 '15 at 02:40
  • I don't think you understand the question. Disabling the server is not the issue. – James Sumners Dec 18 '15 at 02:42
  • Sorry, you're right, I wasn't reading carefully. Have you tried alternate matching on the force-persist? e.g. `force-persist if { urlp(offline) -m str true}`? Maybe the boolean match isn't working as expected. – alzee Dec 18 '15 at 03:06
  • Nope. That results in the same response -- server1's content. – James Sumners Dec 18 '15 at 15:25

0 Answers0