I’m building an app where user can host their dashboard pages on app subdomain - username.myapp.com. App is hosted on Fly.io, I’ve set everything up and subdomains work just fine. The problem is when users want to connect their custom domain to point to their subdomain. I use cloudflare in front and users are getting Cloudflare Error 525 - SSL Handshake Failed.
The thing is, I’ve never built something like this and I don’t really understand how to setup SSL properly. I know I could create certificates on Fly for each user custom domain but is there a better way?
As I said, I don’t have experience with this so I would really appreciate some overview and pointers how something like this should be done.
From your post, it’s really hard to understand what is your deploy topology, are you using cloudflare tunneling or managing your dns records? Also, from where you are serving your https certificates and do you use separate certificates for each subdomain or a wildcard certificate?
I use wildcard certificate for all subdomains, *.myapp.com. Currently I have two of them on Fly, *.myapp.com and myapp.com. I use Cloudflare for dns records and have SSL protection set to full. I don’t know if this is the best way but this is what I have so far.
What for? If you are using fly to terminate ssl, then cloudflare should have only the A record set to point to your server IP, nothing more as it cannot decrypt the traffic. If you are using something like captcha provided by cloudflare, then you most probably need to terminate ssl at cloudflare level.
I don’t use captca, I just use Cloudflare for DNS.
All I want to build really is the ability for users to connect their custom domains to their subdomains on my app. And to be honest, I have no clue how to set it up correctly.
This is just a test app so no real users here so I can change everything, and I just want to learn this thing and I’m completely lost.