We currently have some APIs set up in API Gateway, with a Custom Domain Name defined with a Regional Endpoint and Base Path Mappings that map incoming requests to the appropriate API and deployment stage. For example:
api.example.com/app1/prod/res1
is mapped to the app1
API, prod
stage, and in that API there is a resource res1
directly under the root.
This works great, but now we need to support IPv6. It looks like a CloudFront distribution might be the solution, but trying to define the Distribution's Origin Domain Name to API Gateway's Custom Domain Name Target Domain Name doesn't work. The configuration is as follows:
In CloudFront:
- Origin Domain Name: API Gateway's Target Domain Name (***.execute-api.eu-central-1.amazonaws.com)
- Alternate Domain Names (CNAMEs): api6.example.com
In API Gateway:
- Custom Domain Name: api.example.com
- Target Domain Name (Regional Endpoint): ***.execute-api.eu-central-1.amazonaws.com
It is worth noting that setting the CNAME in CloudFront to be the same as the API Gateway's Custom Domain Name failed since the CNAME already exists.
Also setting the CloudFront Origin Domain Name to a specific API stage's domain worked, but that by-passes our Base Path Mappings that let us easily change stages. I wouldn't like to configure a separate CloudFront Distribution for every API and stage combination.
Any suggestions how to support IPv6 with API Gateway's Base Path Mappings?