Catch all domain

Hello!

I have a server using HestiaCP (Apache + Nginx) which has 2 registered domains (e.g foo and bar). The second domain (bar) is a CMS platform where users may have their own custom domain.

When visiting foo or bar, I can see the hosted pages, as expected.

Now, let’s assume that another person wants to forward his/her custom domain (custom.com) to that CMS (bar) and, creates a CNAME record pointing it to “bar”. Checking it with a CNAME lookup shows that everything is fine.

But, when visiting custom.com in the browser, shows a standard “success” page (with a huge checkmark) that seems to be presented to the visitor whenever the domain is not registered in HestiaCP!

So, my understanding is that Nginx is catching the request and redirecting to the “default server” before it reaches the “bar” domain so, there are no logs for that domain!

Is it possible to change that behavior? How could I change that?

Thank you. :pray:

You can’t configure a catch all domain for web, you would probaly need to add the cname as alias on that web domain.

Hey, @Raphael ! Thank you for the quick reply. 🙇‍♂️

I managed to accomplish what I was aiming for by playing with the default server config. :blush: For that, I’ve made a small change in the nginx proxy_ip.tpl template, as follows, rebuilding the domains later:

server {
    ...

    location / {
        #proxy_pass  http://%ip%:%web_port%;
        proxy_pass  http://127.0.0.1:5555;
    }
}

...

p.s: BTW, the target “bar” domain is running a NodeJS app on a specific port (e.g 5555).

Not sure if that will create any unwanted side effects tho. :thinking: Any thoughts?

Hi @rogerio , I have a similar use case and you gave me the solution! I was searching for hours for that catchall nginx proxy template. Without Hestia I new exactly what to do, but now I wanted to go inline with Hestia rules because I started to love this CP! Thank you!

1 Like

Great, @vladunguru! I’m glad it has helped you. :hugs: