DNS CNAME记录用于保持相同的URL,并指向托管在AWS上的另一个站点。

huangapple go评论76阅读模式
英文:

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

问题

我一直在开发一个React js网站,它将成为我们公司WooCommerce网站的扩展。React网站托管和管理在AWS Amplify上,而WooCommerce网站则托管在WP-Engine上。

我希望该网站保持与以下相同的域名URL:

www.ourdomain.com/my-library,指向托管在Amplify上的React应用,但保持URL为www.ourdomain.com/my-library,这样看起来就像他们仍然在同一个网站上。

我认为我可以使用Route 53创建一个CNAME记录来实现这个目标。有人可以帮我解决这个问题吗?

英文:

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?

答案1

得分: 3

你只能为www.ourdomain.com设置一个CNAME记录,听起来你目前已经有一个指向你的WooCommerce网站的记录。你不能再添加一个同名的记录指向其他地方。如果你还没有将Route53作为你的权威DNS服务器,那么你无论如何都不能使用Route53。

你需要做的是在两个网站前面设置一个代理,根据请求的路径将流量发送到不同的后端(WooCommerce或Amplify),并将你当前的CNAME记录指向该代理。你可以使用AWS的CloudFront服务来实现这一点。

英文:

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.

huangapple
  • 本文由 发表于 2023年8月8日 22:49:06
  • 转载请务必保留本文链接:https://go.coder-hub.com/76860702.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定