Cloudflare argo tunnel gives bad gateway error

I tried disabling the warp, can you please give more troubleshooting steps so that I can make it work with nginx.

My previous issues was that nginx was redirecting to default page, so I removed it and it solved but end up giving bad gateway error.

I think when I will solve the bad gateway error, I will not require the code to put in wp config

if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')
    $_SERVER['HTTPS'] = 'on';