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

gefragt vor 2 Jahren768 Aufrufe
2 Antworten
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
beantwortet vor 2 Jahren
  • 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
EXPERTE
Paul_L
beantwortet vor 2 Jahren

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen