Move nginx to HAProxy config problem

I trying to change proxy/balancer from nginx to HAProxy, but something wrong with my config, and web page is blank(but title correct).

nginx config:

listen       443 ssl http2;
location / {
location /api/

HAProxy config:

frontend https
   bind      :443 ssl crt /certs/path alpn h2,http/1.1
   acl root           path -i   /
   use_backend root_ if root
   acl api            path_beg  /api/
   use_backend api_ if api

backend root_
   balance roundrobin
   server back1 cookie r1 check
   server back2 cookie r2 check

backend api_
  balance roundrobin
  http-request set-uri %[url,regsub(^/api/,/api/2/,)]
  server back1 cookie a1 check
  server back2 cookie a2 check

What have I done wrong?

Check your logs, understand what the URI looks like when it hits the server.