Assigning custom domain with path to an Anvil app

This post describes how to assign a custom top-level domain or subdomain to an Anvil app.

Is it possible to assign a specific path of a custom domain to an app?

Hi Stefano,

Due to how domains and web servers work, that would involve cooperation from whichever web server is serving the original domain. (Eg if I want mycompany.com/foo/ to go to my app, and mycompany.com/foo/_/api/say-hello to go to an API endpoint, etc, I will need to specifically configure the web server for mycompany.com to redirect all traffic under /foo/ to a specific Anvil app.)

We suggest instead using a separate subdomain - eg mycompany.com could be your main website, and app.mycompany.com could be your Anvil app.

Alternatively, you can serve all of mycompany.com from your existing web servers, and add an iframe to the /foo/ page which pulls in your Anvil app from a different domain. Something like:

<iframe src="https://my-app.anvilapp.net" style="position: fixed; top: 0; bottom: 0; left: 0; right: 0">

I would add “… and how Anvil works”. :smile:

For example, and here my question becomes a request, if Anvil had the concept of group of apps and it was possible to assign the domain to the group and a path to each app, we could have something like:

mydomain.com/production/extrusions
mydomain.com/production/panels
mydomain.com/production/assembly
mydomain.com/production/shipping
mydomain.com/sales/quotes
mydomain.com/sales/documents

This way of organizing apps in paths would (1) solve the SEO problem that has been mentioned several times in this forum and (2) replace the proliferation of flat sub-domains with a well organized path structure under a single (sub)domain.

I guess I will try the iframe workaround, but that kind of defeats the purpose. Instead of simplifying the things with Anvil managing the whole infrastructure for me, I need to add one web server and the user needs to wait for the content from two servers instead of one.

We do have a few web domains, but the servers are managed by an external company that uses OpenCart, Joomla, etc. nothing built from scratch. So now I need to either coordinate with them or dedicate a new server to Anvil uplink. :frowning:

1 Like

If I have App A set to domain.com and App B set to other.domain.com anvil will correctly send a user different applications?

UPDATE

Did the old “Try and see if it works” method … It does! Thank you Anvil for always being right :slight_smile:

1 Like