SASS Custom Hostnames problem

Hi there,

Please excuse me, I’m probably going to ask some very dumb questions, I don’t know too much about infrastructure and domains/routing.

I am building a sass and the custom hostnames features sound like something I want to implement.

I think it makes it easier to describe my actual app before the problem:

I’m building a simple photography website builder, you create an account, uploads pic, modify some theme settings and a I generate a static site and host it on a sub domain.

Main site: www.impressionportfolios.com (it’s on Cloudflare)
Custom genrated site: space-rat.impressionportfolios.com

I want to allow customers to use there own domains. I set up a test domain also on Cloudflare, pointing aydinhassan.uk to space-rat.impressionportfolios.com via a cname record.

The custom hostname (aydinhassan.uk) is registered and verified.

However, aydinhassan.uk is 404ing, space-rat.impressionportfolios.com works fine.

Currently the static sites are served via a wildcard server block in nginx like:

server {
    server_name  ~^(?<domain>.+)\.impressionportfolios\.com$;

    listen 443 ssl; 
    ...ssl certs

    index index.html;

    location / {
        root   /some/path/builds/$domain;
        try_files $uri $uri/ =404;
    }
}

Is it still my job to make sure (in the nginx config) that the customers domain (aydinhassan.uk) is routed to the correct folder?

Finally, I really don’t understand what the fallback origin is? Currently I set it to *.impressionportfolios.com. Could anyone maybe explain or give an example when and what it is used for?

Again, sorry for the probably dumb questions, and many thanks for taking the time to read.

Best,
Aydin

Of course. How else would your server know which of your pages to display for any given domain? You also need to make sure to generate an Origin Certificate for that domain and install it on your server.

That is simply the server that requests for custom hostnames are sent to.

Of course. How else would your server know which of your pages to display for any given domain? You also need to make sure to generate an Origin Certificate for that domain and install it on your server.

I don’t know, hence why I asked, and as mentioned I’m not versed in this area. I wondered if there was some internal translation and my server only received the CNAME target.

That is simply the server that requests for custom hostnames are sent to.

Right, but isn’t that what the CNAME target is for? Is *.impressionportfolios.com a valid value ?

Thanks for the reply :slight_smile:

No. The CNAME target is for pointing your customers domain to Cloudflare. It would normally be the same for all customers.

Cloudflare will then send the traffic to your Origin. On higher plans, you can have multiple Origins, and it would be very inconvenient if a customer had to change their CNAME record every time a site was switched to a different Origin.

The name of the record doesn’t matter, it’s target (IP/CNAME) does. The record you chose needs to point to your Origin server.

Okay got it, thanks for your help and the speedy replies! :slight_smile: