# Always using default\_backend

**URL:** https://discourse.haproxy.org/t/always-using-default-backend/2704
**Category:** Help!
**Created:** [July 9, 2018, 11:39am UTC](https://discourse.haproxy.org/t/always-using-default-backend/2704 "2018-07-09T11:39:55Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![mucner76](https://avatars.discourse-cdn.com/v4/letter/m/c68b51/32.png) [@mucner76](https://discourse.haproxy.org/u/mucner76)
#### Post date: [July 9, 2018, 11:39am UTC](https://discourse.haproxy.org/t/always-using-default-backend/2704/1 "2018-07-09T11:39:55Z")

</div>

Hi guys,

i am lost in what I thought would be an easy use case. I have an application not HA ready and try to bind it to a single node of my cluster using this configuration:

global  
log 127.0.0.1 local0  
maxconn 2000  
user haproxy  
group haproxy  
tune.ssl.default-dh-param 2048  
ssl-default-bind-ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA

defaults  
log global  
mode http

# option httplog

# option dontlognull

```
retries 3
option redispatch
timeout connect 5000
timeout client 10000
timeout server 10000

```

frontend www-http-vip10  
bind 194.113.6.10:443 ssl crt /etc/haproxy/ssl/wc\_bitmarck\_org.pem ca-file /etc/haproxy/ssl/cert.cabundle verify optional  
timeout client 1h  
mode http

# These are the conditions I need to

# /Web Client/Share/

# /?ShareToken=

# Wir versuchen die konstante Bedingung für Filesharing zu erfassen

acl want\_app1 path\_dir ._/Web%20Client/Share/._ fshare1-http-vip10  
acl want\_app2 url\_reg -i ._?Sharetoken=._ fshare1-http-vip10

# testing if backend available

acl app1\_avail nbsrv(fshare1-http-vip10) ge 1  
acl app2\_avail nbsrv(fshare1-http-vip10) ge 1

# try to use one host only

use\_backend fshare1-http-vip10 if want\_app1 app1\_avail  
use\_backend fshare1-http-vip10 if want\_app2 app2\_avail  
default\_backend www-http-vip10

frontend ssh-proxy-vip10  
bind 194.113.6.10:22  
default\_backend ssh-backend-vip10  
timeout client 1h  
mode tcp

backend fshare1-http-vip10  
mode http  
timeout connect 30000  
timeout server 30000  
retries 3  
option httpchk GET /  
server fshare1 10.41.229.15:40443 ssl check inter 60000 weight 20 verify none

backend www-http-vip10  
mode http  
balance source  
timeout connect 30000  
timeout server 1h  
retries 3  
option httpchk GET /  
server GP1-HTTPS 10.41.229.15:20443 ssl check inter 60000 weight 10 verify none  
server GP2-HTTPS 10.41.229.15:40443 ssl check inter 60000 weight 20 verify none  
server GP3-HTTPS 10.41.229.15:60443 ssl check inter 60000 weight 30 verify none  
server GP4-HTTPS 10.41.229.16:20443 ssl check inter 60000 weight 10 verify none  
server GP5-HTTPS 10.41.229.16:40443 ssl check inter 60000 weight 20 verify none  
server GP6-HTTPS 10.41.229.16:60443 ssl check inter 60000 weight 30 verify none

backend ssh-backend-vip10  
mode tcp  
balance roundrobin  
timeout server 1h  
stick-table type ip size 200k expire 30m  
stick on src  
default-server inter 1s  
server GP1-SSH 10.41.229.15:20022 weight 30  
server GP2-SSH 10.41.229.15:40022 weight 20  
server GP3-SSH 10.41.229.15:60022 weight 10  
server GP4-SSH 10.41.229.16:20022 weight 30  
server GP5-SSH 10.41.229.16:40022 weight 20  
server GP6-SSH 10.41.229.16:60022 weight 10

could anyone help and tell me what I am doing wrong? It is always using default backend

---

<div class="post-metadata">

### Author: ![lukastribus](https://avatars.discourse-cdn.com/v4/letter/l/7ea924/32.png) [@lukastribus](https://discourse.haproxy.org/u/lukastribus)
#### Post date: [July 9, 2018, 12:48pm UTC](https://discourse.haproxy.org/t/always-using-default-backend/2704/2 "2018-07-09T12:48:46Z")

</div>

> [@mucner76](#):
>
> ```
> acl want_app1 path_dir . */Web%20Client/Share/.* fshare1-http-vip10
> acl want_app2 url_reg -i . *?Sharetoken=.* fshare1-http-vip10
> 
> ```

Whats the trailing `fshare1-http-vip10` supposed to do? Remove it.

> [@mucner76](#):
>
> ```
> # testing if backend available
> 
> acl app1_avail nbsrv(fshare1-http-vip10) ge 1
> acl app2_avail nbsrv(fshare1-http-vip10) ge 1
> 
> ```

I think you made your configuration unnecessarily complex. Why would you need to content-switch based on backend availability? Does your default backend serve the filesharing app? If not, then this doesn’t make sense.

---

<div class="post-metadata">

### Author: ![mucner76](https://avatars.discourse-cdn.com/v4/letter/m/c68b51/32.png) [@mucner76](https://discourse.haproxy.org/u/mucner76)
#### Post date: [July 9, 2018, 1:45pm UTC](https://discourse.haproxy.org/t/always-using-default-backend/2704/3 "2018-07-09T13:45:49Z")

</div>

Thanks, you are so right… “fshare1-http-vip10” was bogus extra value.

in the backend fshare1-http-vip10 there will be different ports from different loadbalancers pointing to same backend server. So I want this test to be done but commented it out for the meantime

I changed to:

# Example for Expressions

# [https://myurl.com/Web%20Client/Share/OutgoingWizard.htm](https://myurl.com/Web%20Client/Share/OutgoingWizard.htm)

# [https://myurl.com/?ShareToken=2A4AD21A59EF0CF9DA150999E4FAD5DA1E82B335](https://myurl.com/?ShareToken=2A4AD21A59EF0CF9DA150999E4FAD5DA1E82B335)

# Regex to get above

#acl want\_app1 url\_reg ._/Web\ Client/Share/._  
acl want\_app1 url\_reg -i ._/Web%20Client/Share/._  
acl want\_app2 url\_reg -i ._?ShareToken=._

# Wir prüfen ob das Backend da ist

#acl app1\_avail nbsrv(fshare1-http-vip10) ge 1  
#acl app2\_avail nbsrv(fshare1-http-vip10) ge 1

# Wir setzen den Server auf dx804

#use\_backend fshare1-http-vip10 if want\_app1 app1\_avail  
#use\_backend fshare1-http-vip10 if want\_app2 app2\_avail  
use\_backend fshare1-http-vip10 if want\_app1  
use\_backend fshare1-http-vip10 if want\_app2  
default\_backend www-http-vip10

any more ideas? Results still in Backend: www-http-vip10

---

<div class="post-metadata">

### Author: ![mucner76](https://avatars.discourse-cdn.com/v4/letter/m/c68b51/32.png) [@mucner76](https://discourse.haproxy.org/u/mucner76)
#### Post date: [July 10, 2018, 11:16am UTC](https://discourse.haproxy.org/t/always-using-default-backend/2704/4 "2018-07-10T11:16:04Z")

</div>

Could somebody please take a look? I am using CentOS haproxy is Version 1.5.

It is so weired. I tried different ways to catch the URL

```
#acl want_app1 url_reg .*\/Web\ Client\/Share\/.*
acl want_app1 path_reg .*\/Web%20Client\/Share\/.*
acl want_app2 path_reg .*\?ShareToken=.*
# Wir prüfen ob das Backend da ist
#acl app1_avail nbsrv(fshare1-http-vip10) ge 1
#acl app2_avail nbsrv(fshare1-http-vip10) ge 1
# Wir setzen den Server auf dx804
#use_backend fshare1-http-vip10 if want_app1 app1_avail
#use_backend fshare1-http-vip10 if want_app2 app2_avail
#use_backend fshare1-http-vip10 if want_app1
use_backend fshare1-http-vip10 if { path_reg .*\/Web\ Client\/Share\/.* }
use_backend fshare1-http-vip10 if { path_reg .*\?ShareToken=.* }
#use_backend fshare1-http-vip10 if want_app2
default_backend www-http-vip10

```

Syntax is always fine but in logfile its always  
Jul 10 13:14:29 localhost haproxy[29776]: Connect from 217.89.44.130:35289 to 194.113.6.10:443 (www-http-vip10/HTTP)

---

<div class="post-metadata">

### Author: ![mucner76](https://avatars.discourse-cdn.com/v4/letter/m/c68b51/32.png) [@mucner76](https://discourse.haproxy.org/u/mucner76)
#### Post date: [July 10, 2018, 11:11pm UTC](https://discourse.haproxy.org/t/always-using-default-backend/2704/5 "2018-07-10T23:11:29Z")

</div>

Ok, punch me if you see me or in other words… raising debuglevel proofed anything doing as expected since leasson I. Next question am I ready for vacation… Indeed! Sorry wasting your Time!
