Haproxy template / select backend/server using header

I am trying to target a backend server using a request header (x-upstream) which has the target server
ip. example x-upstream: 10.100.20.13:24001

I was able to achieve this bye the following script .
however as you can see we need a backend block for each server
IS there a better way to avoid repetition ? and make this better

frontend localnodes
bind *:3005
mode http
option httplog
log /dev/log local0 debug
acl is_backend_set hdr_len(x-upstream) gt 0
http-request set-var(req.backend) hdr(x-upstream) if is_backend_set
http-request set-path /swbizlogic/service.svc
http-request set-header Content-Type application/test
use_backend backend-%[var(req.backend)] if is_backend_set
default_backend nodes

backend nodes
mode http
timeout http-request 90s # set to low value for slowloris
timeout connect 10s
timeout server 90s
balance roundrobin
server svr1 10.100.20.13:24001 weight 100
server svr2 10.100.20.13:24002 weight 100
server svr3 10.100.20.13:24003 weight 100
backend backend-10.100.20.13:24001
mode http
timeout connect 10s
timeout server 90s
http-response add-header x-upstream %b
http-request set-header Content-Type application/test
http-request set-path /swbizlogic/service.svc
server svr 10.100.20.13:24001 weight 100

backend backend-10.100.20.13:24002
mode http
timeout connect 10s
timeout server 90s
http-request set-header Content-Type application/test
http-response add-header x-upstream %b
http-request set-path /swbizlogic/service.svc
server svr 10.100.20.13:24002 weight 100
backend backend-10.100.20.13:24003
mode http
timeout connect 10s
timeout server 90s
http-request set-header Content-Type application/test
http-response add-header x-upstream %b
http-request set-path /swbizlogic/service.svc
server svr 10.100.20.13:24003 weight 100