Keeping cookies and request headers as small as possible ensures that an HTTP request can fit into a single packet.
Ideally, an HTTP request should not go beyond 1 packet. The most widely used networks limit packets to approximately 1500 bytes, so if you can constrain each request to fewer than 1500 bytes, you can reduce the overhead of the request stream. HTTP request headers include:
- Cookies: For resources that must be sent with cookies, keep the cookie sizes to a bare minimum. To keep the request size within this limit, no one cookie served off any domain should be more than 1000 bytes. We recommend that the average size of cookies served off any domain be less than 400 bytes.
- Browser-set fields: Many of the header fields are automatically set by the user agent, so you have no control over them.
- Requested resource URL (
GET
andHost
fields). URLs with multiple parameters can run into the thousands of bytes. Try to limit URL lengths to a few hundred bytes at most. - Referrer URL.