Nodejs AWS EC2 404 Not Found

0

Hey there,

Nodejs app deployed on AWS EC2, other software/ services include Apache, configured ACM, and Cloudfront. DNS is a 3rd party service.

Throws following error:


Not Found
-------------------
The requested URL was not found on this server.

Apache/2.4.41 (Ubuntu) Server at ec2-XXX.eu-central-1.compute.amazonaws.com Port 80

What could be the reason?

Thanks for your help :)

已提问 2 年前768 查看次数
2 回答
0

Hello,

Not Found error usually occurs when the Requested Object/File is not present in the Server or the Requested location, so can you please check the Server or the requested location if the particular requested file is present

AWS
已回答 2 年前
  • Thanks for the reply.

    Deployed app and all the files were reachable prior to cloudfront configuration. Obviously there is no change in the files or there location now.

    https://xxxxx.com/api/auth/login << is the URL that fails, not sure the routing via "https://xxxxx.com" is appropriate or should it be "/api/auth/"

0

The error message is clearly coming from Apache indicating the requested object is not found. The apache logs would be a good place to start for troubleshooting. However, if this behaviour is new since configuring CloudFront, it might be due to the host header value: CloudFront will set the Host header to the origin DNS domain name when making requests to it, unless you configure it to forward the Host header: https://aws.amazon.com/premiumsupport/knowledge-center/configure-cloudfront-to-forward-headers/

Could it be that you've configured apache to respond to requests for www.example.com and not ec2-xxxxx.amazonaws.com?

AWS
专家
Paul_L
已回答 2 年前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则