All Posts In Header

Debugging a Chrome Mobile + Cloudflare 520 Mystery
Adam C. |
Ran into a weird issue where only Chrome on mobile (not desktop, Firefox, or Edge) kept throwing Cloudflare 520 errors after login redirects, with nginx logs showing nothing helpful. The root cause turned out to be oversized request headers (cookies + Chrome UA-Hints) that blew past nginx’s default limits; under HTTP/2 these just closed the connection silently, showing up as 000 in access.log. Fix was simply raising nginx’s header buffer limits, which solved it immediately. Lesson: modern apps produce very large headers, and if you see random 520s on Chrome mobile, check header sizes before chasing TLS or proxy ghosts.
Understanding HTTP Header Size Limits in Apache and Nginx
Adam C. |
Both Apache and Nginx enforce limits on HTTP header sizes to prevent abuse, which can trigger confusing 400/431/502 errors when apps use large cookies or JWTs; by default, Apache allows ~8 KB per header in HTTP/1.x and 64 KB total in HTTP/2, while Nginx defaults are even tighter (1 KB per header line, 8 KB response headers), so tuning directives like LimitRequestFieldSize, H2MaxHeaderListSize, client_header_buffer_size, and proxy_buffer_size is often necessary—but keep values reasonable (≈16 KB per header, 128 KB total) to balance real-world needs with memory efficiency and DoS protection.