Hi everyone, I need a little help/guidence...
I have a SaaS CRM that also provides a simple landing page creator. As of right now the public ULR for the landing pages are:
landing.saasdomain.com/brand/page-name
I want my users to be able to setup a sub-domain via cname so the landing page URL can be:
subdomain.branddomain.com/page-name
Does anyone have a guide on how we could set that up?
Our tech stack is Laravel, AWS, Cloudflare.
Thanks in advance for the help!
If you resolve a wildcard record to your server IP, your users can point an unlimited number of CNAME records to your domain, and you can figure out the page to serve based on vhosts (or via another mechanism on your server).
Example:
Your record:
*.saasdomain.com in A 12.34.56.78You give your customers a URL: foo.saasdomain.com
They optionally add their own domain via a CNAME:
foo.saasdomain.com in CNAME foo.branddomain.comThen you have a ton of options server-side (like nginx vhosts).
If you're not going to give users subdomains under your domain, you can just point CNAMEs to any valid A records (it doesn't need to be wildcard).
Thanks!
Not sure how it would go with CloudFlare as your front end, but we are on a pure AWS stack here at hrpartner.io, and managed to successfully set up CNAMES by setting up a Caddy Server on a EC2 micro instance to act as a reverse proxy for any of our customers who wants to use their own domain.
Basically, they set up a CNAME record in their DNS to point whatever.customerdomain.com to our Caddy proxy server, and we just reverse proxy the request to our normal Elastic Beanstalk load balancer listening on customersubdomain.hrpartner.io. Took us a very short time to set it all up and it has been working a treat for a couple of months now. Caddy takes care of all the SSL generation and renewals etc. so it is a completely 'hands free' method for us.
More info on Caddy - https://caddyserver.com/
Caddy server has been working a treat for us too. We use it as a reverse proxy (similar set-up to @Devan) serving about 1.2k custom domains and sub domains.
I will look into Caddy Server, it might just be what we need. Thanks!
Hey Roberto, I can help you out with some tips on this. Just followed you on Twitter, feel free to send me a DM.
If you're using Cloudflare, there is a very cool feature for that - Cloudflare Workers that can be used for many things including rewriting URL requests based on URL-path (prefix). You can even do that on the primary domain (better for SEO).
Example: https://github.com/kriasoft/nodejs-api-starter -> "proxy"