Setting up a custom domain

When you create a portal for your Cloud Endpoints API, by default the portal is hosted on the cloud.googdomain, which Google owns and manages. The default URL to your portal is in the following format:

https://endpointsportal.[YOUR_PROJECT_ID].cloud.goog

This is the default URL even if you specified a custom domain (such as example.com or my-api.example.com) in the name field of your gRPC service configuration file.

If you want the users of your API to access your portal using a custom domain, you need to configure the Cloud Endpoints Portal and the DNS settings in your domain name registrar. When you add a custom domain to your portal, the Cloud Endpoints Portal displays the type of DNS record and other information that you need to configure in your domain name registrar.

This page describes how to configure the Cloud Endpoints Portal to use a custom domain. For each task, the minimum required Cloud Identity and Access Management permission or role required to complete the task is provided. For more information about Cloud IAM permissions, see the following:

Prerequisites

This guide assumes that:

  • You have created your portal.
  • You are a verified owner of the domain you'll want to use. Additionally, you will need to know how to configure DNS in your domain name registrar.

Adding a custom domain

Minimum required permissions: Project members granted the Endpoints Portal Admin role or the Project Editor role have the required endpoints.portals.listCustomDomains and endpoints.portals.attachCustomDomain permissions.

  1. In the Google Cloud Platform Console, go to the Endpoints > Developer Portal page for your project.

    Go to the Cloud Endpoints Portal

  2. Click Add a custom domain.
  3. Enter either a root domain or subdomain name.
  4. Click Continue to add the domain.
  5. The Cloud Endpoints Portal displays Update your DNS records. Add the DNS records using your domain name registrar for all the records listed in the Update your DNS records section.

    • If you entered a root domain such as example.com, the Update your DNS records section displays a list of A records and AAAA records with IP addresses. For example:

      Type Data Alias
      A 198.51.100.0 -
      A 198.51.100.2 -
      A 198.51.100.4 -
      A 198.51.100.6 -
      AAAA 2001:db8:ffff:32::15 -
      AAAA 2001:db8:ffff:34::15 -
      AAAA 2001:db8:ffff:36::15 -
      AAAA 2001:db8:ffff:38::15 -

      The configuration steps and terminology for adding multiple A and AAAA records for a domain name vary depending on your domain name registrar. If you are unsure, search the documentation for your domain name registrar for terms like: record set or multiple responses.

    • If you entered a subdomain such as apidocs.example.com, the Update your DNS records section displays a CNAME. For example:

      Type Data Alias
      CNAME ghs.googlehosted.com apidocs

  6. Click Done.

  7. You can now visit your portal by clicking the custom domain link. This may take up to 24 hours to be functional depending on DNS record propagation.

Google will provision an SSL certificate only after you have added the DNS records using your domain registrar. Until then, the custom domain will not work with your portal, even using http://. However, you can continue using the default URL that is displayed on the Endpoints > Developer Portal page.

Viewing the information to add to DNS

Minimum required permissions: Project members granted the Endpoints Portal Admin role or the Project Viewer role have the required endpoints.portals.listCustomDomains permission.

To see the information that you need to add (or that has been added) to your domain name registrar:

  1. In the GCP Console, go to the Endpoints > Developer Portal page.

    Go to the Cloud Endpoints Portal

  2. Select the GCP project that owns the API.
  3. Click DNS details next to the custom domain.

Deleting a custom domain

Minimum required permissions: Project members granted the Endpoints Portal Admin role or the Project Editor role have the required endpoints.portals.listCustomDomains and endpoints.portals.detachCustomDomain permissions.

  1. In the Google Cloud Platform Console, go to the Endpoints > Developer Portal page for your project.

    Go to the Cloud Endpoints Portal

  2. Click delete next to DNS Details for your custom domain.
  3. Click Delete on the confirmation dialog box.

Troubleshooting

Adding a custom domain fails with a generic pop up error. There might be many reasons for this. Make sure that the default URL to your portal, endpointsportal.[PROJECT_ID].cloud.goog, is functional. If the default URL does not work, delete the portal and then follow the steps in Creating a Portal for your Endpoints API to recreate it.

Adding a custom domain failed, but it still shows up in the main page's table. This is a known issue that the domain might still show up in the main page. You can always delete the custom domain, using the garbage icon, and add it again.

Clicking on the "DNS details" shows an empty table with no records to add. This can happen if adding the custom domain failed but it still shows up in the table. We suggest deleting the custom domain and starting over.

The custom domain link doesn't work. You need to ensure that you've added the DNS records correctly with your domain registrar. After you've done so, it can take up to 24 hours for the custom domain to work.

I don't have permission to add a custom domain. You must have either the Editor or Owner role in the GCP project that your API is in. See Creating and Managing Custom Roles for more information.

I would like to reuse the same domain name I have used for my App Engine application. A specific domain name can only serve one web application. Therefore, if you reuse the same domain name you've already used with an App Engine application, adding the custom domain to your portal will fail. Make sure to use a domain name that is not being used elsewhere.

Was this page helpful? Let us know how we did:

Send feedback about...

Cloud Endpoints with gRPC
Need help? Visit our support page.