After some digging I found out that that creating a X-Forwarded-Host rewrite rule with the new domain in Azure Application Gateway and together with setting this enviroment variable:
{
name: 'GF_SECURITY_CSRF_TRUSTED_ORIGINS'
value: '[publicdomain].com'
}
did the trick.