Although each web server software has some limitations, there is a difference whether there’s a limit for the HTTP request line plus header fields or for each header field.
Here’s a summary:
- Apache 1.3, 2.0, 2.2, 2.3: 8190 Bytes (for each header field)
- IIS:
- 4.0: 2097152 Bytes (for the request line plus header fields)
- 5.0: 131072 Bytes, 16384 Bytes with Windows 2000 Service Pack 4 (for the request line plus header fields)
- 6.0: 16384 Bytes (for each header fields)
- Tomcat:
- 5.5.x/6.0.x: 49152 Bytes (for the request line plus header fields)
- 7.0.x: 8190 Bytes (for the request line plus header fields)
So to conclude: To be accepted by all web servers above, a request’s request line plus header fields should not exceed 8190 Bytes. This is also the limit for each header fields (effectively even less).
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…