How to use top level domain enable routes with the same hostname and domain name
search cancel

How to use top level domain enable routes with the same hostname and domain name

book

Article ID: 298307

calendar_today

Updated On:

Products

VMware Tanzu Application Service for VMs

Issue/Introduction

Customer would like TAS support routes to 4 different apps with these mappings:

app1 - domain.example.com
app2 - api.domain.example.com
app3 - sandbox.domain.example.com
app4 - api.sandbox.domain.example.com

Note: all or the apps are for the same org, app 1 and 2 are in the same space, app 3 and 4 are in same space.

When they tried to create a new private domain, it errored out as below:

$ cf create-private-domain ORG api.sandbox.domain.example.com
Creating private domain api.sandbox.domain.example.com for org ORG as ######
The domain name "api.sandbox.domain.example.com" cannot be created because "domain.example.com" is already reserved by a route

This is due to they've already have a shared domain "example.com" and one app with route "domain.example.com".

 

Environment

Product Version: 2.11

Resolution

Refer to doc: https://docs.cloudfoundry.org/devguide/deploy-apps/routes-domains.html#private-domains, when using private domains, you can have routes with the same hostname and domain name across different orgs and spaces. This cannot be done with shared domains.

To fulfill customer's request, we have had domain.example.com as the top level domain and sandbox.domain.example.com as subdomain. And top level domain required to be created as private domain.

Based on customer's current situation, we can follow below steps:
  1. Delete the route domain.example.com: cf delete-route example.com -n domain
  2. Create a private-domain as top level domain: cf create-private-domain ORG domain.example.com
  3. Map the top level domain to App1: cf map-route <App1_name> domain.example.com
  4. Push App2 and map route: cf map-route <App2_name> domain.example.com -n api
  5. Target to another space with the same org, create a private-domain as subdomain: cf create-private-domain ORG sandbox.domain.example.com

Note: You can create a private subdomain for a private parent domain only if the domains belong to the same org.

     6 .Push App3 with "--no-route" and map route: cf map-route <App3_name> sandbox.domain.example.com
     
7 .Push App4 with "--no-route" and map route: cf map-route <App4_name> sandbox.domain.example.com -n api