Skip to main content

Manage Domain Mappings

Domain mappings provide you the ability to customize the way traffic is routed between domains and origins. If you have a single domain and a single origin, your routing rules should be straight forward. However, if you have multiple domains and multiple origins, then you need to define how a request for a specific domain should be routed, i.e to which origin the request should go to after it passes the CDN. Domain mapping is defined by:

  • Domain name
  • Path pattern
  • Origin

Example

For example, assuming you have the following configuration:

  • Domain mapping 1:

    • Domain - www.example.com
    • Path pattern - /blogs/*
    • Origin - my-blogs-bucket.s3-us-west-2.amazonaws.com
  • Domain mapping 2:

    • Domain - www.example.com
    • Path pattern - /images/*
    • Origin - my-images-bucket.s3-us-west-2.amazonaws.com

Given the configuration above the following requests will be routed: https://www.example.com/blog/myblog.html -> my-blogs-bucket.s3-us-west-2.amazonaws.com https://www.example.com/images/mydog.jpg -> my-images-bucket.s3-us-west-2.amazonaws.com

Adding a New Domain

When you first add a domain, you specify the initial mapping for it, you can use the value /* as the path pattern to route the entire domain to specific origin. After the domain was created, you can add additional mappings as described below.

Adding a Domain Mapping

Adding an additional domain mapping is very similar to adding a domain. You simply specify the name of the existing domain, in the Domain field. Then you can specify the additional path pattern and the origin you would like to route traffic to.

To add a domain mapping:

  1. Navigate to your service.
  2. On the sidebar, choose Domains.
  3. Click on the Create Domain Mapping button.
  4. Fiil the new domain mapping form:
    • Domain - Fill the name of the existing domain.
    • Path - The path which should be mapped to the destination origin. Use /* to route the entire domain to an origin.
    • Destination - Select an origin from the list of your service origins. See this page, on how to add an origin.

Once created, the new mapping should appear on the table next to the domain name.

Adding a Path Mapping

If you only want to add an additional path to the same domain and origin, you can add it via Adding a Domain Mapping. However, there is a simpler way, you can add it directly without specifying domain and origin again.

To add a path mapping:

  1. Navigate to your service.
  2. On the sidebar, choose Domains.
  3. Navigate to the existing Domain and Origin mapping, click on Add New Path.
  4. Type the new path.
  5. Click on Save.

Once created, the new path mapping should appear in the table inside the row matching the existing domain and origin.

Updating a Mapping

For an existing mapping, you can only update the path of the mapping. If you wish to update the domain or origin, you should add a new mapping and delete the existing one.

To update a path mapping:

  1. Navigate to your service.
  2. On the sidebar, choose Domains.
  3. Navigate to the existing mapping path. When you hover your mouse over the path, the Edit icon should appear. Click on it.
  4. Type the new path.
  5. Click on Save.

Once updated, the updated path should appear in the table.

Deleting a Mapping

You can delete each one of the path mappings. Once all paths have been removed for a given domain and origin, the entire mapping is deleted as well.

To delete a path mapping:

  1. Navigate to your service.
  2. On the sidebar, choose Domains.
  3. Navigate to the existing mapping path. When you hover your mouse over the path, the Delete icon should appear. Click on it.

Deleting a Domain

In case you want to delete an entire domain from your configuration, you need to remove all the mappings related to this domain. Once all mappings are removed, the domain is automatically deleted and removed from the list of the service domains.