I followed the tutorials in AWS docs and using this video on youtube https://www.youtube.com/watch?v=BIQks_drQHM . What I am trying to do is route traffic to verus-ai.com and www.verus-ai.com. The only way I am able to run my application when I do yarn build and yarn serve is if I use the
Public IPv4 DNS ec2-44-206-65-182.compute-1.amazonaws.com
with the port of 8080, essentially you can access it if you paste this into th e browser: ec2-44-206-65-182.compute-1.amazonaws.com:8080.
I want to be able to perform the same thing but with the domain I have i.e. verus-ai.com.
Domain Name: verus-ai.com
I was told from AWS support that the way everything is setup on Route 53 is correct and then problem resides on the application side.
I do not have much experiece with this part but there are 2 places in which the application is running on port 8080, specifically on the backend side
// set port, listen for requests
const PORT = process.env.PORT || 8080;
app.listen(PORT, () => {
console.log(`Server is running on port ${PORT}.`);
});
and the front end side
export default axios.create({
baseURL: "http://localhost:8080/api ",
headers: {
"Content-type": "application/json",
"Access-Control-Allow-Origin": "*",
}
});
should I remove the port 8080?
First, you need to create a CNAME record in your DNS that points your domain name, or a subdomain of it, to the EC2 instance: ec2-44-206-65-182.compute-1.amazonaws.com
. Ideally you would assign an ElasticIP to the instance first so the IP doesn't change later if you have to shut it down for any reason.
Second, You need to change the backend to run on port 80
instead of 8080
, because the default HTTP port is port 80
and that is the port that is used by web browsers when you enter an http://
address without specifying a port.