HAProxy parsing errors

5,063

Try this instead :-)

frontend http-frontend
    bind  *:80
    mode http
    reqadd X-Forwarded-Proto:\ http

    acl blog_acl path_beg /wp-admin

    use_backend wwwru  if { src -f RU.subnets }
    use_backend wwwbackend { src -f RU.subnets }

    use_backend wwwru  if blog_acl

    default_backend wwwbackend
Share:
5,063

Related videos on Youtube

Ibbi co
Author by

Ibbi co

Updated on September 18, 2022

Comments

  • Ibbi co
    Ibbi co over 1 year

    i have 3 servers

    --> haproxy - server1(uk)
                - server2(ru)
    

    i followed this tutorial and created ip for ru.subnets

    now in my /etc/haproxy i have these files:

    haproxy.conf
    ru.subnets
    

    in my haproxy.conf:

    frontend http-frontend
        bind  *:80
        mode http
        reqadd X-Forwarded-Proto:\ http
    
        acl blog_acl path_beg /wp-admin
    
        acl ru_acl  src -f  RU.subnets
    
       use_backend wwwru  if ru_acl
        use_backend wwwbackend if !ru_acl
    
        use_backend wwwru  if blog_acl
    
        default_backend wwwbackend
    

    everything looks okay but when i try to load config file in my haproxy i get these errors:

    [ALERT] 170/084453 (4661) : parsing [/etc/haproxy/haproxy.cfg:37] : error detected while parsing ACL 'ru_acl'.
    [ALERT] 170/084453 (4661) : parsing [/etc/haproxy/haproxy.cfg:39] : error detected while parsing switching rule.
    [ALERT] 170/084453 (4661) : parsing [/etc/haproxy/haproxy.cfg:40] : error detected while parsing switching rule.
    [ALERT] 170/084453 (4661) : Error(s) found in configuration file : /etc/haproxy/haproxy.cfg
    [ALERT] 170/084453 (4661) : Fatal errors found in configuration.