haproxy NOSRV issue with redirected port

I am attempting to catch http traffic on one port (8080) and redirect it to an internal port (12345). I have the following in my haproxy.cfg

frontend rest_front
   bind *:8080
   #reqadd X-Forwarded-Proto:\ http
   #reqadd X-Forwarded-Port:\ 12345

   acl host_rest hdr(host) -i mypublicserver.myhost.com

   stats uri /haproxy?stats
   acl url_blog path_beg /blog

   # figure out which one to use
   use_backend rest_cluster if host_rest

backend rest_cluster
   server rest_server_host myinternalserver.myotherhost.com:12345 check

When I test the connection to mypublicserver.myhost.com I see the following in the log file ...

Aug 10 14:18:35 myproxy haproxy[30258]: <IP_ADDRESS>:56779 [10/Aug/2017:14:18:35.309] rest_front rest_front/<NOSRV> -1/-1/-1/-1/2 503 213 - - SC-- 1/0/0/0/0 0/0 "GET /somepage.html HTTP/1.1"

I can't figure out why the back end is not hit. The URL I'm using is http://mypublicserver.myhost.com:8080/somepage.html which should trigger the acl.


There is no default backend to use and rest_cluster is used only when host_rest ACL is valid.
So any request with a HOST header not matching "mypublicserver.myhost.com" will not be routed to any backend and this results in a 503 error.
So you can either add a default_backend directive or drop/edit the ACL.

EDIT: if the ACL is not matching this is because it is missing the port part: 8080
Try with:

 acl host_rest hdr(host) -i mypublicserver.myhost.com:8080