ccampbell/chromelogger

ChromePhp - Ngnix 502 Bad Gateway error

eltelemaco opened this issue · 3 comments

This is a useful extension, but there is a problem with some Ngnix and apache server due big header data sent by ChromePhp json, you can skip this issue by only using when really need it, with no abuse.

+1
Seldaek/monolog#206
#23

Seldaek/monolog#172 :

Researched it a bit and I patched it, chrome seems to have a limit of 256KB across all headers, so splitting it like firephp wouldn't help. Anyway if someone can confirm it works fine it'd be nice.

...

splitting it like firephp likely would help.
AWS application load balancers also seem to have a low header limit making it near impossible to use chromelogger with modern AWS resources.

Maybe do something like 1 header entry per log call, then stop at a configurable combined header length with a final warn('too many logs..') entry.
(clients can handle that last part, but chromelogger extension needs to support the mutli-header approach to make this extension usable at all anymore)

bump

https://docs.aws.amazon.com/elasticloadbalancing/latest/userguide/how-elastic-load-balancing-works.html

The following size limits for Application Load Balancers are hard limits that cannot be changed.

HTTP/1.x Headers
Request line: 16 K
Single header: 16 K
Whole header: 64 K

HTTP/2 Headers
Request line: 8 K
Single header: 8 K
Whole header: 64 K

would really like to chunk the output into multiple headers

https://craig.is/writing/chrome-logger/techspecs

  1. First you should JSON encode it:
  2. Then you should utf8 encode it:
  3. THEN you should base64 encode it:
  4. Finally, you may optionally split it into chunks and prefix each chunk sequentially.. 'x:'
X-ChromeLogger-Data: 1:chunk_o_data
X-ChromeLogger-Data: 2:chunk_o_data
X-ChromeLogger-Data: 3:chunk_o_data

This will also necessitate a new protocol version header
X-ChromeLogger-Version: 2.0

(omission of X-ChromeLogger-Version would imply "1.0")