Help!!!! FastAPI uvicorn app behind Cloudflare proxy

Hi I have a fast api uvicorn app running behind an nginx on a GCP VM with statis IP. I am using CloudFlare as my DNS. I have 2 records. 1. The first record DOES NOT use Cloudflare proxy. I am correctly able to make Rest calls to the FastAPI server using both http and https 2. The second record has Cloudflare proxy enabled. When trying to call the rest api now, I get "Bad Gateway Error". Does anyone know what special configuration do I need to do for Uvicorn, Nginx, FastAPI, or Cloudflare to prevent this error. I would obviously like to use Cloudflare proxy for additional security and performance benefits it provides.
1 Reply
yogi
yogi3mo ago
Looking forward to any tip.