The issue seems to be with the DNS configuration. To ensure that customers can create their subdomains and map them to their domain using a CNAME configuration, you need to make a few changes.
- Update the DNS configuration for the customer's domain,
support.waitlist.guru, to point to your SaaS application's subdomain,waitlist.layoff.wtf. The CNAME record should be set as follows:
CNAME | support | waitlist.layoff.wtf. | 600 seconds
- In your Caddyfile configuration, you need to add a wildcard subdomain matcher to handle requests for any subdomain. Update the
httpsblock in your Caddyfile as follows:
https:// {
tls {
on_demand
}
root * /home/forge/layoff.wtf/public
file_server
php_fastcgi unix//run/php/php8.2-fpm.sock
# Add this wildcard subdomain matcher
@subdomain {
host_regexp .+
}
# Route requests for any subdomain to the appropriate subdomain on your application
reverse_proxy @subdomain http://waitlist.layoff.wtf
}
With these changes, requests to support.waitlist.guru should be correctly routed to waitlist.layoff.wtf, serving the appropriate subdomain of your SaaS application.
Make sure to restart Caddy server after making these changes for them to take effect.