HAProxy community

Routing by domain

Hi, my server have 2 apps are running at port 3000 and 3001. I want to use 2 domain to point to these apps. Here is my config:

frontend Local_Server
    bind *:80
    mode http
    acl app2_req hdr_dom(host) -i domain2.tk
    use_backend app2 if app2_req
    default_backend app1

backend app1
  server app1 localhost:3000 check

backend app2
  server app localhost:3001 check

But it seem not working @@, anyone can help me?
Thank all very much!

I think you might want to use hdr_end here.
maybe something like

use_backend app2 if { hdr_end(host) -i domain2.tk }
default_backend app1