Im setting up an application in aws and I have added a custom domain name for my lambda functions. Im from a spring boot world and my first thought was that if I run a solution on www.mydomain.com then my website should be reached by www.mydomain.com and my api gateway should use www.mydomain.com/apii. But when I try to distribute my webpage with cloudfront Im not allowed to use the custom domain name since its already used for my api gateway.
Am I just doing it wrong or should I think differently. I mean should my cloudfront and lambda run on different custom domains? but then Ill have to allow cors right?
Looking forward to hear from you guys.