Page MenuHomePhabricator

Size of headers processed by varnish?
Closed, ResolvedPublic

Description

Recent instances of too-long-user-agents made me wonder if we have a limit to the length of the headers processed via varnish, seems like we should .

See for example a recent UA (see parent task also for counts of how many where these long on a given hour)

Mozilla/5.0 (X11; Linux x86_64_128) AppleWebKit/11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111.111111111111111111111111111111111111111111111111111111111111111111111111 (KHTML, like Gecko) Linux/222222222222222222222222222222222222222222222222222222222222222222222222....

continues to 2035 characters

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
ema triaged this task as Medium priority.Jun 29 2018, 8:18 AM
ema moved this task from Backlog to Caching on the Traffic board.

Both varnish and nginx limit the maximum request header length to 8k by default. We have set nginx's limit to 16k, while leaving the default on varnish untouched.

It seems like a good idea to ensure that the two settings match, either by increasing http_req_hdr_len on varnish if we do indeed need to accept request headers up to 16k in length, or by decreasing large_client_header_buffers on nginx if that is not the case.

Ya, 8k seems quite a bit, not sure why would we need more than that in either end.

Vvjjkkii renamed this task from Size of headers processed by varnish? to 3aaaaaaaaa.Jul 1 2018, 1:01 AM
Vvjjkkii removed JAllemandou as the assignee of this task.
Vvjjkkii raised the priority of this task from Medium to High.
Vvjjkkii updated the task description. (Show Details)
Vvjjkkii added a subscriber: JAllemandou.
JJMC89 renamed this task from 3aaaaaaaaa to Size of headers processed by varnish?.Jul 1 2018, 3:10 AM
JJMC89 assigned this task to JAllemandou.
JJMC89 lowered the priority of this task from High to Medium.
JJMC89 updated the task description. (Show Details)
JJMC89 edited subscribers, added: Aklapper; removed: JAllemandou.
elukey added a subscriber: JAllemandou.

Both varnish and nginx limit the maximum request header length to 8k by default. We have set nginx's limit to 16k, while leaving the default on varnish untouched.

So I've tried increasing http_req_hdr_len on Varnish, but then found that also Apache at the application layer (Mediawiki) imposes a limit of 8192 on the maximum request header length.

We changed the nginx setting 8 years ago: to "allow for larger sets of cookies": https://phabricator.wikimedia.org/rOPUPf738b5ea1db6a1608cc0dbd41a8d887002fdba49. I'm not sure if the change ever worked across the whole stack, it definitely does not work now though. I think we can safely revert that change at this point and have 8192 as the maximum length for a single request header line (name+value).

Change 520235 had a related patch set uploaded (by Ema; owner: Ema):
[operations/puppet@production] Revert "Increase client header buffer size, to allow for larger sets of cookies."

https://gerrit.wikimedia.org/r/520235

Change 520235 merged by Ema:
[operations/puppet@production] Revert "Increase client header buffer size, to allow for larger sets of cookies."

https://gerrit.wikimedia.org/r/520235

ema claimed this task.

The maximum allowed request header size (field name + value) is now 8192 bytes. Closing.