r/programminghorror • • Oct 23 '26

GitHub's HTTP header

Post image

This is the crazy thing I've found after analysis why the CI test fails with "Maximum header size exceeded" today.

964 Upvotes

53 comments sorted by

View all comments

482

u/Belialson Oct 23 '26

Company I work at was proxing some endpoints to us, it was a big shop. They used to set a cookie with json containing entire user’s session including every page visited and it’s details.
Same effect but unfortunately on production

92

u/buckypimpin Oct 23 '26

isnt a cookie max 4KiB?

125

u/RegisteredJustToSay Oct 24 '26

That's per cookie (name + value). You can store many times that if you break it up over multiple keys, tho max 180 per host on chrome. You could fit ten text copies of Alice in wonderland in that space.

You're right though, of course. Just don't want to give anyone here the idea that you're limited to this little space per domain.

37

u/RustOnTheEdge Oct 24 '26

Alice in Wonderland is roughly 170kb, so it would fit 4.3 times in all the available header space.

18

u/SuspiciousSegfault Oct 24 '26

How well does it compress though?

15

u/RegisteredJustToSay Oct 25 '26

Weird, specifically checked gutenberg and saw it was under 80 kB but now on desktop it says 170 kB. Was on mobile though so may have been a presentation issue. Thanks for the correction!

11

u/RustOnTheEdge Oct 25 '26

I found it such a nice unit of measurement, well done for that!

24

u/caboosetp Oct 23 '26

You can fit quite a bit in 4k before it causes issues that a browser restart can fix and push off the issue.

5

u/Chesterlespaul Oct 24 '26

Interesting idea. Obviously don’t do this. But I wonder sort of data this could be useful for.

15

u/groumly Oct 24 '26

Asp (can’t remember if it was the og or the .net one, I think .net) did a lot of crap like that back in day.

It was used to turn stateless web framework into a stateful mode iirc.

12

u/lenswipe Oct 24 '26

Ah yes __VIEWSTATE

I remember seeing that hidden field in a form, decoding it and was like ".....no fucking way"

6

u/groumly Oct 24 '26

Oh, that rings a bell, yes. Wait, so was it actually stored in cookies then? Or did I get confused and it was just passed in a hidden form on every damn link of every damn page?

9

u/lenswipe Oct 24 '26

no it was a hidden form field that got posted between pages

5

u/dunder_name Oct 25 '26

that sounds like a nightmare

3

u/lenswipe Oct 25 '26

I've never had to maintain it. But I've seen it on a few websites...

1

u/Chesterlespaul Oct 24 '26

Oh that would be so useful back in the day! Reactive state set from web requests.