mirror of
https://github.com/caprover/caprover
synced 2026-09-26 16:45:39 +00:00
chore: allow user to connect subdomain of app domain.
Some apps (eg: tiredofit/docker-baserow) require multiple domains. To reduce friction for the user, we don't want to split the app into multiple sub-apps or require the user to manually change Nginx template config or mess with Le'tsEncrypt certs. The simplest solution is to allow users to add app's subdomain. For Caprover's server with root domain is root.domain.com, we have app1 at app1.root.domain.com. Allow users to connect subdomain api.app1.root.domain.com.
This commit is contained in:
@@ -275,6 +275,7 @@ class ServiceManager {
|
||||
.then(function () {
|
||||
const rootDomain = self.dataStore.getRootDomain()
|
||||
const dotRootDomain = `.${rootDomain}`
|
||||
const appDomain = appName + dotRootDomain
|
||||
|
||||
if (!customDomain || !/^[a-z0-9\-\.]+$/.test(customDomain)) {
|
||||
throw ApiStatusCodes.createError(
|
||||
@@ -301,7 +302,7 @@ class ServiceManager {
|
||||
customDomain.indexOf(dotRootDomain) >= 0 &&
|
||||
customDomain.indexOf(dotRootDomain) +
|
||||
dotRootDomain.length ===
|
||||
customDomain.length
|
||||
appDomain.length
|
||||
) {
|
||||
throw ApiStatusCodes.createError(
|
||||
ApiStatusCodes.STATUS_ERROR_BAD_NAME,
|
||||
|
||||
Reference in New Issue
Block a user