I’m having an issue with the AWS API Gateway’s custom domain feature. I have no problem doing base mappings for paths like /login and /dashboard, but if I also want to add a base mapping for the root (just blank or /), I get an error saying if I want a blank one, I can’t have any others. Is there any workaround to this?
Sure, happy to elaborate. In the API Gateway’s custom domain area, you can set base mappings so that www.mydomain.x/this maps to the lambda function “this” and www.mydomain.x/that maps to the lambda function “that”. This is all working perfectly. My issue is that I also want something to happen when people simply go to www.mydomain.x (no further base mapping…just the root of the domain). When I add a blank base mapping, it says if I have a blank one, I can’t have any more. I want to know if there’s a workaround as obviously I’d rather have something happen when people go to www.mydomain.x.
@RegNatarajan you will prolly have to do the root domain/CNAME mappings via CloudFront or Route53
Thanks for that but I have already set up the domain for Cloudfront and I use Route53 to map to that Cloudfront FQDN. I actually have to do that for the other mappings to work. Setting up a second CNAME would obviously break the ones I have.
This is a limitation of API Gateway Custom Domains…
You get either root mapping, or 1+ context mapping.
You “could” map your domain to a S3 bucket
Then enable Static website hosting on the bucket and config configure Redirect requests to point to an API endpoint.
That’s what I was afraid of. I’m not crazy about redirecting subfolders to the API directly as the URLs will be ugly. I hope AWS addresses this but for now I’ll just use a subdomain (app.mydomain.com) and accept that I can’t have anything in /
It’s not what I wanted to hear but thanks for the confirmation.