Struggling to redirect one non-www domain to www over ssl

I am trying to redirect one domain behind my HAProxy load balancer from non-www to www prefix in Rancher over SSL. All the other redirections are working fine. is being redirected to https://www.example. But is not being redirected to

Here is my config in Rancher:

frontend 80
acl lepath path_beg -i /.well-known/acme-challenge
redirect scheme https code 301 if !{ hdr(host) -i } !lepath !{ ssl_fc }
redirect prefix code 301 if  { hdr(host) -i } !lepath
redirect prefix code 301 if  { hdr(host) -i } !lepath !{ ssl_fc}

I am fairly new to HAProxy. I have gone through a lot of documentation but none of the configs are working here. Can someone help me out with it? -> -> -> -> -> (Not working)

Share the entire configuration please.

This is the entire Custom config I have in the Rancher dashboard.

Then I won’t be able to help you, this forum is about haproxy, not rancher, we need to know how haproxy is configured.