I have a EC2 instance on which I am running a React App and a domain from Route 53, for example xyz.com
.
For this xyz.com
I have two subdomains say www.xyz.com
and demo.xyz.com
.
Now, traditionally my React App serves on PORT 3000 on this instance. I have configured the IP with the PORT using nginx
on my instance, something like this 192.1.1:3000
. Now whenever I hit this domain (www.xyz.com
) I am redirected to 192.1.1:3000
.
For example, if I have two versions of my app called dev and prod. dev serves on PORT 3000 and prod serves on PORT 3002.
I want to www.xyz.com
to redirect to 3000 and demo.xyz.com
redirect to 3002. Both of these are from the same DNS provider.
Is there a away to achieve this?