Switching Application Domains

Page last updated:

Warning: Pivotal Cloud Foundry (PCF) v2.5 is no longer supported because it has reached the End of General Support (EOGS) phase as defined by the Support Lifecycle Policy. To stay up to date with the latest software and security updates, upgrade to a supported version.

This topic describes how to change the domain of an existing Pivotal Cloud Foundry (PCF) installation, using an example domain change from myapps.mydomain.com to newapps.mydomain.com.

  1. In PCF Ops Manager, select the Pivotal Application Service tile.

  2. Select Domains from the menu to see the current Apps Domain for your Pivotal Application Service (PAS) deployment. In the following example it is myapps.mydomain.com.

    Er17 switchdomains before

  3. In the terminal, run cf login -a YOUR_API_ENDPOINT. The cf CLI prompts you for your PCF username and password, as well as the org and space you want to access. See Identifying the API Endpoint for your PAS Instance if you don’t know your API endpoint.

  4. Run cf domains to view the domains in the space. If you have more than one shared domain, ensure that the domain you want to change is at the top of the list before you apply the new domain to your PAS tile configuration. You can delete and re-create the other shared domains as necessary to push the domain you want to change to the top of the list. If you do this, make sure to re-map the routes for each domain.

        $ cf domains
        Getting domains in org my-org as admin...
        name                  status
        myapps.mydomain.com   shared
  5. Run cf routes to confirm that your apps are assigned to the domain you plan to change.

        $ cf routes
        Getting routes as admin ...
        space      host    domain                apps
        my-space   myapp   myapps.mydomain.com   myapp
  6. Run cf create-shared-domain YOUR_DESIRED_NEW_DOMAIN to create the new domain you want to use:

        $ cf create-shared-domain newapps.mydomain.com
        Creating shared domain newapps.mydomain.com as admin...
  7. Run cf map-route APP_NAME NEW_DOMAIN -n HOST_NAME to map the new domain to your app. In this example both the NEW_DOMAIN and HOST_NAME arguments are myapp, since this is both the name of the app to which we are mapping a route, and the intended hostname for the URL.

        $ cf map-route myapp newapps.mydomain.com -n myapp
        Creating route myapp.newapps.mydomain.com for org my-org / space my-space as admin...
        Adding route myapp.newapps.mydomain.com to app myapp in org my-org / space my-space as admin...
  8. Repeat the previous step for each app in this space. Afterwards, check Apps Manager to confirm that the route URL has updated correctly for each app:

    New domain confirmed1

  9. Repeat the above steps for each space in your PCF installation except for the System org, beginning with logging into the org and space and ending with confirming the URL update.

    Note: Ordinarily the System org contains only PCF apps that perform utility functions for your installation. Pivotal does not recommend pushing apps to this org. However, if you have pushed apps to System, you must also repeat the above steps for these apps.

  10. Once you have confirmed that every app in every space has been mapped to the new domain, delete the old domain by running cf delete-shared-domain OLD_DOMAIN_TO_DELETE:

        $ cf delete-shared-domain myapps.mydomain.com
        Deleting domain myapps.mydomain.com as admin...
        This domain is shared across all orgs.
        Deleting it will remove all associated routes, and will make any app with this domain unreachable.
        Are you sure you want to delete the domain myapps.mydomain.com?
        > yes
  11. Configure your PAS tile to use the new domain, and apply changes. Apps that you push after your update finishes use this new domain.

    Er17 switchdomains after