# Is custom base domain possible yet? (Feb 2017)

**URL:** <https://forum.serverless.com/t/is-custom-base-domain-possible-yet-feb-2017/1259>\
**Category:** Serverless Framework\
**Created:** [February 3, 2017, 9:20pm UTC](https://forum.serverless.com/t/is-custom-base-domain-possible-yet-feb-2017/1259 "2017-02-03T21:20:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jjasonclark](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/jjasonclark/32/303_2.png) [@jjasonclark](https://forum.serverless.com/u/jjasonclark)\
**Post date:** [February 3, 2017, 9:20pm UTC](https://forum.serverless.com/t/is-custom-base-domain-possible-yet-feb-2017/1259/1 "2017-02-03T21:20:05Z")

</div>

Can we make a custom domain yet for our API Gateway functions in any format?

- https:// **random**.mycompany.com/ **serverless\_path**
- https:// **random**.mycompany.com/ **random** / **serverless\_path**
- https:// **random**.mycompany.com/ **fixed** / **random** / **serverless\_path**
- https:// **fixed**.mycompany.com/ **serverless\_path**
- https:// **fixed**.mycompany.com/ **random** / **serverless\_path**
- https:// **fixed**.mycompany.com/ **fixed** / **random** / **serverless\_path**

_Spaces added to prevent links in markup._

**fixed** means something the developer picked.  
**random** means the random code given by default when making a APIG endpoint  
**serverless\_path** means the path picked by the developer for the APIG endpoint

---

<div class="post-metadata">

**Author:** ![matt-filion](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/matt-filion/32/427_2.png) [@matt-filion](https://forum.serverless.com/u/matt-filion)\
**Post date:** [February 9, 2017, 2:00pm UTC](https://forum.serverless.com/t/is-custom-base-domain-possible-yet-feb-2017/1259/2 "2017-02-09T14:00:52Z")

</div>

All of this can be done, but not directly within serverless. You can put a CloudFront distribution in front of your serverless applications, which itself, can have a Route 53 domain alias. This would give you the subdomain for your API’s that you are looking for as well as the ability to have multiple serverless definitions (API Gateway definitions) within the same domain.

Not sure when/if CloudFront definitions will come to serverless. There is a limitation on being able to supply your own SSL for a CloudFormation defined CloudFront definition, IIRC and there may be other limitations as well making it better to define this manually rather than through configurations. However, that is just a guess.

---

<div class="post-metadata">

**Author:** ![matt-filion](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/matt-filion/32/427_2.png) [@matt-filion](https://forum.serverless.com/u/matt-filion)\
**Post date:** [November 11, 2017, 11:34am UTC](https://forum.serverless.com/t/is-custom-base-domain-possible-yet-feb-2017/1259/3 "2017-11-11T11:34:12Z")

</div>

To follow up this article was written recently to describe how to set it up directly with serverless, in much more detilal.

> **[How to set up a custom domain name for Lambda & API Gateway with Serverless](https://serverless.com/blog/serverless-api-gateway-domain/)**
>
> Learn how to set up a custom domain name for AWS Lambda & API Gateway using the Serverless Framework to configure a clean domain name for your services.

This plugin has also been created since then.

> **[dougmoscrop/serverless-plugin-custom-domain](https://github.com/dougmoscrop/serverless-plugin-custom-domain)**
>
> serverless-plugin-custom-domain - Add API Gateway Custom Domain BasePathMappings reliably

---

<div class="post-metadata">

**Author:** ![bfieber](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/bfieber/32/653_2.png) [@bfieber](https://forum.serverless.com/u/bfieber)\
**Post date:** [November 13, 2017, 5:32pm UTC](https://forum.serverless.com/t/is-custom-base-domain-possible-yet-feb-2017/1259/4 "2017-11-13T17:32:06Z")

</div>

Another option: [serverless-domain-manager plugin](https://github.com/amplify-education/serverless-domain-manager)  
I’m using this one in my project and it’s worked well. Handles creation of the Route53 record as well as variable basePath by stage.

Here’s the relevant section from my serverless.yml

```auto
plugins:
  - serverless-domain-manager

custom:
  default_stage: jack
  stage: ${opt:stage, self:custom.default_stage}
  customDomain:
    domainName: api.mycorp.com
    certificateName: wildcard.mycorp.com
    basePath: ${self:custom.stage}
    stage: ${self:custom.stage}
    createRoute53Record: true

```

Hope it helps.
