Allow `MAX_HEADERS` to be configurable.
What is the problem this feature would solve?
Currently a system my team and I would like to migrate over is blocked by headers not being passed through. This is because there's a hard limit of 50 set here: https://github.com/oven-sh/bun/blob/131b96bbba3c2fc02b418e36a1ec0f9f7801171d/packages/bun-uws/src/HttpParser.h#L49C1-L49C1
Allowing this value to be configurable would allow us to increase it as we've audited the headers we're sending and we could get down only to around 70.
What is the feature you are proposing to solve the problem?
An optional config option that gives control over this constant.
What alternatives have you considered?
- Upping the
MAX_HEADERSvalue. This doesn't seem like a future proof solution. - We attempted to get down to below 50 headers but as it's a very large system it doesn't look possible without a major refactor.
We should probably increase the default value, and adding some way to configure this makes sense.
We should probably increase the default value, and adding some way to configure this makes sense.
That'd be great! Would you like me to create a PR for it? If so, what value sounds reasonable to increase it to?
I'll leave the configurability to you unless you're clear on how you'd like it done and could point me in that direction.
@TomHennessy i wonder what response/return data was sent from bun when max_headers are reached?
trying to debug a similar issue, in my case it was "connection terminated"
This has been bumped to 100 - but is still not configurable. We spent some time debugging 431 errors we're seeing in production code, do you think we could bump that limit?
There's no limitation for this in the HTTP spec - current limit: https://github.com/oven-sh/bun/blob/8dc084af5f2c23d3e97cdf955f525b2f84aa4206/packages/bun-uws/src/HttpParser.h#L20-L22