How to point multiple URLS to same databse

Hi all,

What I want to do is point multiple urls to the same database/environment. For each of my clients I have unique branding and each client has a unique subdomain.

For example:
client1.mybusiness.com
client2.mybusiness.com

My current setup is that each domain is published as an environment and points to a database of its own. However, this is difficult to maintain with many clients. I want to start having multiple clients on the same database, but still provide a unique url to each client.

Has anyone done something like this before?

You can use the same database on multiple environment.

Yes, but I don’t want to manage a separate environment for each client. I’d like to give each client a unique URL which they can share with their clients and contains their name in the URL.

Maybe you could rig something up with Anvil Extras routing? I cant tell how though to be honest.

https://anvil-extras.readthedocs.io/en/latest/guides/modules/routing.html

1 Like

I also wonder how businesses (knowledge bases, etc.) do this without the manual setup of multiple subdomains. There’s gotta be a way, but I suspect that way has to do with managing your own deployments programmatically.

Even the Anvil team has to do a manual step when I add a custom domain to an app.

Routing is nice and may be an acceptable workaround if you don’t mind the hash in the URL.

With something like a LAMP stack / Apache You typically set up a wildcard subdomain that points somewhere in your server, that intercepts the prefix of the domain and uses it as a variable for some sort of lookup on what to serve to the client.

I have no idea how to do this with anvil as a “first layer” server.

1 Like