I have deployed a Phoenix app on Fly.io and my DNS settings are on Cloudflare. For this, I created A and AAAA records on my domain for the IP addresses from
flyctl ips list. Those records are proxied by Cloudflare. The Phoenix app is running perfectly fine when accessed at the URL provided by Fly.io. However when accessed from my custom domain, it results in a 520 HTTP error. Do I need to change something in the Phoenix app configuration for this to work?
I have found what was wrong. I had to put the SSL/TLS encryption mode to Full in the SSL/TLS settings for my domain. Hopefully this helps someone else in the future.
Glad it works. But you can use ssl full on cloudflare with fly.io (should be a bit more secure but im no networking expert so dont know how big risk it is in practice). All you need to do is set up custom domains in fly too (you might wanna do the cname verification). That is how I run my apps (cloudflare for security and some caching and fly for the app)