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 :)

asked 2 years ago744 views
2 Answers
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
answered 2 years ago
  • 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
EXPERT
Paul_L
answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions