Search code examples
amazon-web-serviceshttp-redirectdnsamazon-route53cname

DNS CNAME record to maintain the same URL and point to another site hosted on AWS


I have been working on a React js site that will be an exctension of my companies WooCommerce site, the react site is being hosted and managed on AWS Amplify and the WooComerce site is hosted with WP-Engine.

I would need the site to maintain the same domain URl as:

www.ourdomain.com/my-library to point to my react app hosted on Amplify but to keep the url as www.ourdomain.com/my-library so it looks like they are still on the same site.

I think I can create a CNAME record using route 53? Could any one help me on this one please?


Solution

  • You can only have one CNAME record for www.ourdomain.com, and it sounds like you currently have one that is pointing to your WooCommerce site. You can't add another one with the same name pointing somewhere else. And if you aren't already using Route53 as your authoritative DNS sever, then you can't use Route53 for this at all anyway.

    What you need to do is setup a proxy in front of both websites, that sends traffic to the different backends (WooComerce or Amplify) depending on the request's path, and change your current CNAME record to point to that proxy. The AWS service that you would use to accomplish this is CloudFront.