-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Reporting] Blacklist Transfer-Encoding
HTTP header for PDF report generation.
#20755
[Reporting] Blacklist Transfer-Encoding
HTTP header for PDF report generation.
#20755
Conversation
💚 Build Succeeded |
}); | ||
|
||
afterEach(() => generatePdfObservableFactory.mockReset()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note: we need this to make sure that every test tests what it should. E.g. omits blacklisted headers
should fail if we add some header to blacklistedHeaders
that's not blacklisted in real code, but it passed before this change since generatePdfObservable
mock call history was shared between tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Code looks good. I tested a PDF report both with and without the basepath proxy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, tested that a phantom pdf report can now be generated.
6.x/6.4: 31c633e |
After #18951 base path proxy started to use
Hapi v17
andh2o2 v8.1.2
, that may addTransfer-Encoding: chunked
HTTP header to requests that are being proxied. That sounds like a reasonable thing to do and not sure why previous versions didn't do that.Transfer-Encoding
is hop-by-hop header that is meaningful only for a single transport-level connection, and shouldn't be stored by caches or forwarded by proxies. This affected reporting since PDF generation forces underlying browser to re-transmit some of the headers from the original request that created PDF generation job with every request used during screenshotting, includingTransfer-Encoding: chunked
. That doesn't make any sense and gets worse when underlying browser addsContent-Length
header and hence violates HTTP spec, makes Node to reject such requests and fail PDF generation job as a result.It feels like it can happen in a wild even without the change introduced by the new platform, so I'm proposing to just blacklist
Transfer-Encoding
HTTP header.To test, please try to generate PDF reports when Kibana is run in dev mode:
Fixes #20724