TR EN

HTTP 500 Internal Server Error: find the cause

500 means an unexpected server condition prevented the request from completing. The status alone cannot tell you which component failed.

500

HTTP 500 Internal Server Error

HTTP RFC Standard

If you are visiting the website

For a read-only page, wait briefly and try once more. If the error follows a payment, order or form submission, check whether the action completed before submitting again. Report the page, time and any request ID without private query values or account details.

If you maintain the application

  1. Establish the scope. Is one route affected or the whole site? Compare the same method and route in application monitoring. A working homepage does not prove that an API operation is healthy.
  2. Correlate the failure. Use the time and request ID to find the matching application, runtime and web-server errors. On Apache, the ErrorLog configuration determines the log location; a copied Linux path may be wrong.
  3. Check the most recent change. Compare the last working release with changed configuration, code and dependencies. If you roll back, first check database migration compatibility and confirm the original failing request afterward.
  4. Follow the specific log evidence. An exception calls for application debugging; a failed database connection calls for checking that dependency. Confirm permissions, resource limits or configuration errors only when the evidence points there. Do not apply blanket writable permissions.

Capture a read-only response

Substitute a safe GET route you administer. This prints response headers without saving the body:

curl -sS -D - -o /dev/null --max-time 15 https://example.com/protected-resource

The command does not follow redirects. Use the original application method and client when reproducing a different request; do not replay payments or other writes blindly. Keep detailed stack traces in private logs, not the public error page. Remove cookies from headers before sharing them.

A custom error page is not a repair

Nginx error_page changes error handling and presentation. A friendly page can help visitors, but the underlying failing operation still needs diagnosis. Preserve an appropriate error status and verify the application after fixing the cause.

Related server errors and search visibility

Compare 502: invalid upstream response, 503: temporary unavailability and 504: upstream timeout. Do not relabel an unexplained 500 just to hide it from monitoring.

Google slows crawling when server errors occur; persistent errors can eventually remove affected URLs from the index. Restoring 200 does not guarantee indexing. Google’s HTTP guidance.

References: RFC 9110, 500 semantics · Apache error logs · Nginx error_page. Related: 401 authentication failures.

Frequently Asked Questions

Does HTTP 500 prove that the database is down?
No. A database failure is one possibility, but application exceptions and configuration problems can also produce 500. Correlate the failed request with logs before choosing a fix.
Should I keep retrying a POST after a 500?
Do not assume the action failed completely. Check its recorded outcome and the API’s retry or idempotency contract before repeating a payment, order or other write.