Setup matomo behind two reverse proxy servers

Hi, I am trying to work out how to configure Matomo behind two proxy servers.
Our authentication gateway behaves as a proxy server and allows us access to web apps. Those web apps are running behind Traefik and docker compose.

When I try to login to matomo with the above setup, matomo throws a form security error and won’t allow the login.

There seems to be a way to set up Matomo behind multiple reverse proxies but I can’t work it out.

Thanks in advance.