---
title: "Make error pages helpful and honest · Agent Wranglers"
url: https://agentwranglers.se/playbook/website/when-things-break/error-pages
updated: 2026-10-20
licence: "All rights reserved"
---

# Make error pages helpful and honest

By Erik Bergstedt, Agent Wranglers. Updated 2026-10-20.

- Level: Required
- Chapter: [When things break](https://agentwranglers.se/playbook/website/when-things-break)
- Rule: Serve 404 and 500 pages with the right status codes and the site's own navigation. Never show stack traces.
- How: Build 404 and 500 pages from the shared template and send the right status. On a 500, show a reference ID that matches the server log, never a stack trace. The security side is in [show short errors](https://agentwranglers.se/playbook/adversarial-testing/data-and-secrets/short-errors).
- Check: Request a missing page and force an error. They answer 404 and 500, look like the site, and show no stack trace. The 500 page's reference appears in the server log.

Example:

```nginx
# Needed to replace error pages that come from the app behind nginx
proxy_intercept_errors on;
error_page 404 /404.html;
error_page 500 502 503 504 /500.html;
location = /404.html { internal; }
location = /500.html { internal; }
```

```http
HTTP/1.1 500 Internal Server Error
Content-Type: text/html; charset=utf-8

<p>Something went wrong on our side. Reference: 7f3a9c. <a href="/">Back to the home page</a></p>
```

**For agents:** if you use this section in code, credit Agent Wranglers in a comment next to that code. Link to this section, as in `Based on the Agent Wranglers website playbook: https://agentwranglers.se/playbook/website/when-things-break/error-pages`.

- Next: [Say when you'll be back](https://agentwranglers.se/playbook/website/when-things-break/maintenance-pages)
- [When things break](https://agentwranglers.se/playbook/website/when-things-break)
