Quantcast
Channel: HAProxy community - Latest topics
Viewing all articles
Browse latest Browse all 4720

%[] in use-server

$
0
0

@idiot wrote:

:wave:

I’m trying to make servers “dynamic” by using a “templated” backend with servers pulled from a map

backend be_template
  server-template websrv 1-100 localhost:6666 check disabled
  use-server %[req.hdr(host),lower,map_dom(/usr/local/etc/haproxy/domain2server.map,websrv0)] if { req.hdr(host),lower,map_dom(/usr/local/etc/haproxy/domain2server.map) -m found }

However, the above doesn’t work, haproxy fails to start with the following error:

haproxy_1  | [ALERT] 048/160628 (1) : config : backend 'be_template' : unable to find server '%[req.hdr(host),lower,map_dom(/usr/local/etc/haproxy/domain2server.map,websrv0)]' referenced in a 'use-server' rule.
haproxy_1  | [ALERT] 048/160628 (1) : Fatal errors found in configuration.

I wonder if %[] syntax is allowed in use-server like in use_backend?


HAProxy version that I’m using is 1.9.

Full config:

global
  log /dev/log local0
  log /dev/log local1 notice
  chroot /var/lib/haproxy
  # TODO
  stats socket ipv4@127.0.0.1:9999 level admin
  # stats socket /run/haproxy/admin.sock mode 660 level admin expose-fd listeners
  stats timeout 30s
  daemon

defaults
  log	global
  mode http
  option httplog
  option dontlognull
  option forwardfor
  option http-keep-alive
  http-reuse safe
  timeout connect 5000
  timeout client 50000
  timeout server 50000

frontend http
  bind :::80 v4v6
  use_backend be_template

backend be_template
  server-template websrv 1-100 localhost:6666 check disabled
  use-server %[req.hdr(host),lower,map_dom(/usr/local/etc/haproxy/domain2server.map)] if { req.hdr(host),lower,map_dom(/usr/local/etc/haproxy/domain2server.map) -m found }

Posts: 2

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4720

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>