Hi Takada, Takada Shigeomi wrote: > global > lua-load get_backend.lua > > listen example > mode tcp > bind :30000-50000 > server MYSERVER %[lua.backend] > ----------------------------------- > > ---ERROR CONTENT------ > [ALERT] 194/145111 (21636) : parsing [haproxy.cfg:20] : 'server MYSERVER' : > invalid address: '%[lua.backend]' in '%[lua.backend] > -----------------------------------
You can't dynamically define arbitrary server hosts. The target needs to be fixed, e.g. a fixed IP address or a fixed hostname. Thus, you can't select an arbitrary target server for each incoming connection. What you can do however is to define a number of backends, each containing a fixed server and dynamically selecting the backend where the request should be routed to using something like global lua-load get_backend.lua frontend example mode tcp bind :30000-50000 use_backend example_%[lua.backend] backend example_30000 server MYSERVER 127.0.0.1:30000 backend example_30001 server MYSERVER 127.0.0.1:30001 ... Alternatively, if the IP address if always the same, you can use the same port as the incoming connection by using something like this and omit the port (or specify a delta value) frontend example mode tcp bind :30000-50000 use_backend bk_example backend bk_example server MYSERVER 127.0.0.1 Regards, Holger