Debugging client-side bugs from the server's access log
nginxaccess-logdebugginguser-agent401forensics
When a bug lives on a user's phone (local storage, client-side limits, a screen flow you cannot see), the server's access log is often the only witness. Every screen in an app makes a recognizable burst of requests, so you can reconstruct what the user did, minute by minute, without any client logging. This solved two TLDR bugs that looked impossible from the code alone.
How
- Read the full logs, including rotated ones:
sudo cat /var/log/nginx/access.log*(nginx is the front proxy, so it sees every request with real timestamps and status codes). - Filter by the app's user agent. Flutter's
dart:ioclient sendsDart/<version> (dart:io); browsers send their own UA, which separates the web app from the Android app. - Learn each screen's signature: e.g. opening TLDR's composer fetches
/upload_status,/ai/projectsand/ai/modelstogether. A signature followed by noPOST /postsmeans "opened and backed out". - Line the timeline up with the user's report ("a draft loaded that had already been sent").
Patterns worth grepping for
- 401s from your own app's UA. A client calling an authenticated route without its token gets a
401 it may swallow, then silently uses a hardcoded default. TLDR's upload limit stayed at a
2 MB fallback for weeks this way (
GET /upload_status401 on every launch). - Requests that should never happen (an accidental
DELETEjust before the reported problem). - Request rates per minute from one client: shows background polling that should have stopped.
- 4xx/5xx around a reported failure; their absence is also evidence ("the error never reached the server, so it is client-side").
Limits
Access logs show method, path, status, size and timing, not bodies. Combine with database state (server-side drafts untouched since a date, rows created without follow-up metadata) to close the case.
See also
- Autosaved drafts that come back from the dead (lifecycle pitfalls)
- API authorization from the verified identity (and the holes it closes)
- nginx in front of Apache (TLS proxy on :8008)