Possible to replace HA-Proxy with Traefik for Postgres HA using Patroni?

Hi there.
I would like to know if it is possible to use Traefik instead of HA-Proxy for the following use case:
In a Postgres HA situation, all DB connections need to go to the current Primary server.
If another server becomes the Primary, connections need to be moved to the new server.
We can use a Patroni HTTP end-point to check what server is currently the Primary. (Patroni REST API — Patroni 2.1.4 documentation)

Is this workflow something that is supported?