Redirect loop when deploying ssl enabled app to azure webapp for containers

I case someone else runs into the same problem the solution for me was this

if ($http_x_arr_ssl = "") {
        return 301 https://$host$request_uri;
 }