## 4.2.14.1.6.1.4.8  Using a Custom Domain for the Multitenant Application
The SAP Custom Domain Service (see SAP Custom Domain service ) lets you configure your own custom domain (see What Is Custom Domain?) to publicly expose your application instead of using an SAP-provided default/shared/standard domain like cfapps.eu10.hana.ondemand.com for your application URLs.
By using this service, subaccount owners can make their SAP BTP applications accessible via a custom domain that is different from the default one; for example, myshop.com.
In case of multitenant applications (see Multitenant Applications [page 1248]), using a custom domain comes with another advantage: For each subscription there needs to be a CF route (see Routes ) that is mapped to the approuter module of the multitenant application, so that the application is accessible via a URL.
While using a default domain, a new route like &lt;SUBSCRIBER\_TENANT\_SUBDOMAIN&gt;-&lt;APPROUTER\_APPLICATION\_HOST&gt;.&lt;SAP-PROVIDED\_STANDARD\_DOMAIN&gt; must be created manually for each new tenant.
By configuring the multitenant application with a custom domain, a route with a wildcard hostname like *.&lt;YOUR\_CUSTOM\_DOMAIN&gt; can be mapped, so that there is no need to create a new route for each new tenant manually. For more information, refer to Approuter Application [page 1258].
It is recommended to use a custom domain for your multitenant application only during the production phase; during the development phase using a default domain is sufficient.
Please follow the steps outlined in Configuring Custom Domains or Get Started with the Custom Domain Manager (refer to PaaS-User) to register your custom domain in the provider subaccount's CF org (see Multitenancy in the ABAP Environment [page 1280]). After registering the custom domain successfully, the domain becomes available as private domain (see Private domains ) for route creation in any space of the provider subaccount's CF org.
To create a multitenant application for use with a custom domain, following configurations are adjusted accordingly:
- TENANT\_HOST\_PATTERN configuration of the approuter application: String containing a regular expression with a capturing group. The request host is matched against this regular expression. The value of the first capturing group is used as tenant id. Please refer to TENANT\_HOST\_PATTERN.
- SaaS Registry Callback URLs getDependencies and onSubscription. Please refer to Saas Provisioning Service [page 1256].
- XSUAA OAuth 2.0 Client configuration redirect-uris. Please refer to Listing Allowed Redirect URIs
- CF routes assigned to approuter application
For the subscriptions to the multitenant application to work correctly, configured SaaS Registry callback URLs need to be reachable (cis… route). For Application Routing routing to work, the approuter needs to be able to resolve the application URL based on current TENANT\_HOST\_PATTERN configuration.
You can use theMaintain Solution app in the Landscape Portal to easily create such a multitenant application with custom domain, please refer to Create Deployment Configuration → Step 3: Routing Information .
Or, if you are following the MTA-based approach to create your multitenant application, in the MTA Extension descriptor for production phase these configurations are changed using following MTA parameters:
- app-domain: the registered custom domain, e.g. mydomain.com
- route-prefix: needs to be empty because application URLs are mapped using following structure: *.&lt;YOUR\_CUSTOM\_DOMAIN&gt; (dot separator) and therefore do not include a route prefix
A route with wildcard hostname for tenant access is added to the approuter module, on top of the route used for SaaS Registry callback URLs:
<!-- image -->
```
- route: "*${route-prefix}.${app-domain}"
```
To reduce risks use Blue-Green Deployment of Multitarget Applications while deploying multitenant application MTA during production phase.
After MTA build and deployment, the approuter application is created with a route cis.mydomain.com that is used for the SaaS Registry callback URLs getDependencies and onSubscription . On top of that a route with wild card hostname *.mydomain.com is mapped to the approuter. In this format, since the wildcard is replaced by an actual tenant during runtime, there is no need to create a new route for each new tenant manually.
If you change the domain type of your multitenant application from shared to custom domain, you need to update the application URL of existing subscriptions. Please use the option to update the application URL of an active subscription in the Subscription Management Dashboard. In such case, make sure to inform application consumers beforehand about temporary downtimes that might occur during this change.