Skip to content

503 error on endpoint

0

I am getting a 503 error on the endpoint for the application running on EC2. It was working up until a couple of days ago. The only change I made was to update the security certificate and now I am seeing Failed to load resource: the server responded with a status of 503 (Service Unavailable: Back-end server is at capacity)Understand this errorAI home:1 Access to XMLHttpRequest at 'https://ipapi.co/json' from origin '***********' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.Understand this errorAI ipapi.co/json:1 Failed to load resource: net::ERR_FAILEDUnderstand this errorAI ip-api.io/json:1 Failed to load resource: the server responded with a status of 429 (Too Many Requests)

The logs have lots of repeated 2025/02/10 12:04:15 [error] 3102#0: *115 open() "/var/app/current/public/stylesheets/.env" failed (2: No such file or directory), client: , server: , request: "GET /stylesheets/.env HTTP/1.1", host: "" 2025/02/10 12:09:15 [error] 3102#0: *126 open() "/var/app/current/public/jsconfig.json" failed (2: No such file or directory), client: , server: , request: "GET /jsconfig.json HTTP/1.1", host: ""

The instance state is green Very appreciative of any guidance with this.

asked 2 years ago338 views

1 Answer
0

The 503 error you're experiencing could be due to several factors. Let's break down the issues and potential solutions:

  1. Backend server capacity: The error message suggests that the backend server is at capacity. This could mean your EC2 instance is overwhelmed or not responding properly. Check your EC2 instance's resource utilization (CPU, memory, disk) to ensure it's not overloaded.

  2. CORS (Cross-Origin Resource Sharing) issue: The error indicates a CORS policy problem when trying to access https://ipapi.co/json. This is likely unrelated to your 503 error but could be causing additional issues. You may need to configure CORS settings on your server or use a proxy to handle these requests.

  3. Rate limiting: The 429 error (Too Many Requests) for ip-api.io suggests you might be hitting rate limits. This could be caused by excessive requests from your application.

  4. Missing files: The log entries show attempts to access non-existent files (.env and jsconfig.json). While these are likely not the cause of the 503 error, they indicate potential misconfiguration or unnecessary requests.

  5. Certificate update: Since the issue started after updating the security certificate, verify that the new certificate is properly installed and configured. An incorrectly configured SSL/TLS certificate can cause connection issues.

To resolve these issues:

  1. Check your EC2 instance's health, including CPU usage, memory, and disk space. Consider scaling up if necessary.
  2. Review your application's CORS configuration and ensure it's set up correctly for the required external resources.
  3. Implement rate limiting in your application to avoid hitting external API limits.
  4. Clean up any unnecessary file requests in your application.
  5. Double-check your SSL/TLS certificate configuration, ensuring it's properly installed and matches your domain.
  6. Review your load balancer configuration (if you're using one) to ensure it's correctly routing traffic to your EC2 instance.
  7. Check your security groups and network ACLs to ensure they allow the necessary inbound and outbound traffic.

If the issue persists after these steps, you may need to dig deeper into your application logs and server configuration to identify the root cause of the 503 error.
Sources
503 Service Temporarily Unavailable with load balancer | AWS re:Post
Resolve RequestCount metric drop in Application Load Balancer | AWS re:Post
CORS Access-Control-Allow-Origin Header missing - Api Gateway HTTP / EC2 | AWS re:Post

answered 2 years ago

  • The auto answer didn't help and I have checked all that. All I changed was to update the certificate when requested by AWS. The other site using the certificate has no issues, it is just this one.

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.