Anvil Community Forum

Fetch the domain name of the app

I want to select a different database for the user to access depending on the URL they use to access the app. One client might use xxx.domain.com, another might use anotherdomain.com and yet another might use subdomain.anotherdomain.com.

These are to be custom domains and i will maintain a table of domain -> database mappings, so how to I get the domain they entered in their browser?

EDIT -

actually, this is nonsense.
I have to create a new app for each one anyway to enter the custom domain. So a new app would be the facade selecting the database, and the rest of the code would be included (dependencies) from a core app.

I’m moving this to Feature Requests, because actually it would be really nice to allow multiple domain names pointing to the same app. Of course, then you would also need access to the current origin, as you suggest. We’ll add it to the list.

2 Likes

Is this coming up on the roadmap? Need to be able to change branding based on a different custom urls. Will definitely need access to the current origin.

1 Like