I'm having some issues getting my apache virtual host to load the correct folder on my server. I'm building a public status pages feature for my platform, and one feature is allowing users to specify a custom sub-domain of their own domain, that loads the status page on my platform.
I run everything through one server, my website, back-end and my public status pages, all of which use apache virtual hosts to load these folders.
For the purposes of this, I have two cloudflare accounts, we'll call them Client and Company (where I'm the company).
My current status pages exist on status.company.com, it runs through Cloudflare, it's an A record pointed to my server IP.
I'd like to dish out a different URL for customers though in case things change, so I've created a psp.company.com CNAME record (no proxy) that points to status.company.com, and have created the following virtual host:
<VirtualHost *:80>
ServerName psp.company.com
ServerAlias *.psp.company.com
DocumentRoot /var/www/company-status-pages/dist
ErrorLog /var/log/httpd/psp.company-error.log
CustomLog /var/log/httpd/psp.company.com-access.log combined
</VirtualHost>
When I visit in my browser either status.company.com or psp.company.com I see the intended result, my status pages website, all be it non-HTTPs when I visit psp.company.com for some reason.
Next, the Client then has a website which is separate from my system, their DNS runs through their own cloduflare account, which, I've instructed to create a CNAME record of their choice, they created status.client.com which points to psp.company.com, no proxy.
When they load up status.client.com, they do make it to my server, but it doesn't load the status pages, it loads the apache default webserver page which is not the intended result given that I've created the *
wildcard sub-domain part.
What am I missing, and how could I get SSL to work too? I'm using Apache 2.4