How to customize subdomains in custom apps

I have used frappe_docker to create a custom app with one site that has ERPNext, Helpdesk, and HRMS installed.

I want to implement subdomain-based routing within this single site. Specifically:

• The main website should be accessible at example.com.

• ERPNext should be accessible at erpnext.example.com.

• Helpdesk should be accessible at helpdesk.example.com.

• HRMS should be accessible at hrms.example.com.

I want to achieve this without creating multiple sites (i.e., one app per site). Instead, I want all apps to remain installed in the same site and be served via specific subdomains.

Is it possible to configure this within Frappe? If so, I’d greatly appreciate guidance or pointers to the right direction.

Thanks in advance!

1 Like

Yes, it is possible to have all the applications in a single site instead of multiple ones and separate them using subdomains. To achieve this, you need to use ‘multi-tenancy,’ which is exactly what you’re describing.

Can you give some steps to achieve this?

Why not do this using the reverse-proxy?

Do you use NginX or Traefik?

1. Enable DNS Multi-Tenancy

bench config dns_multitenant on

2. Add Domain to Site

setup add-domain {domain-name} --site {site-name}

3. Update NGINX Configuration & Restart

bench setup nginx

sudo service nginx restart

4. Access Site Using Domain

Note (for local development only): If you’re testing on your local machine without DNS, map the domain to 127.0.0.1 by adding this to /etc/hosts :

127.0.0.1 {site-name}

Hello @Dharanipathi

But how:

sub.domain.tld

Will redirect to the proper App?

how will it redirect to the proper app,
i have single site
multiple apps,
app1, app2, app3
“sub1.xyz” = app1
“sub2.xyz” = app2
“sub3.xyz” = app3

all are custom react apps

That is totally wrong. Multitenancy is related to the host names you server a site or many sites on an application server.
How are you planning to serve applications on the same site with different hostnames? What is the bench command or configuration for that?

I think what you are asking:

  1. is making no sense
  2. calls for bad design
  3. sounds of extensive ignorance of the frappe framework

The initial question is seprating apps via hostnames on the same site.

Apologies, I misunderstood the question earlier. @Tufan_Kaynak2