Frontend code is hosted on frontend.netlify.app
and
Backend code is hosted on backend.herokudns.app
Is there a way to map a single host name, www.myapp.com
to both frontend.netlify.app
and backend.herokudns.app
?
I can't achieve this on Google Domains using CNAME record - it only allows me to map www.myapp.com
to either frontend.netlify.app
or backend.herokudns.app
.
Motivation
To make AJAX requests from my frontend without getting CORS error. Without solving this problem, I have to map something like api.myapp.com
to backend.herokudns.app
which creates an additional step of side-stepping CORS error since AJAX requests will be to a different domain.
CodePudding user response:
There is no way to map a domain to multiple other domain names, AFAIK. I believe this is largely to avoid a situation where one domain name maps to a bunch of other domain names, that all map to other domain names, thus resulting in a DNS amplification attack for each DNS query for the original domain name.