You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was looking at proxy.js source code and found the following statement:
// lib/proxy.js file, line 69if(settings.onResponse){deleteoptions.headers['accept-encoding'];}
Removing the 'Accept-Encoding' from the headers that are forwarded to the upstream endpoint can be harmful, since response compression is quietly disabled. Why is this done?
I can imagine the short answer is: "If the developer wants to handle the response himself, Hapi can help him disabling the response compression". If so, I believe it's not a good idea to consider the presence of an onResponse handler to disable response compression. Wouldn't it be better creating a new option on proxy, like "disableResponseCompression: true|false"?
The text was updated successfully, but these errors were encountered:
This is mostly due to historical reasons. It used to be that when you define an onResponse handler, hapi gave you back the payload, not the res stream. So this was needed to solve encoding while hapi didn't know how to decode the response for you.
It doesn't make much sense now, but at the same time, removing it isn't ideal. I think we need a new option that lets you set any other encoding you accept and the default will be to remove it. This way it is backwards compatible for now.
This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.
lockbot
locked as resolved and limited conversation to collaborators
Jan 9, 2020
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
breaking changesChange that can breaking existing codefeatureNew functionality or improvement
I was looking at proxy.js source code and found the following statement:
Removing the 'Accept-Encoding' from the headers that are forwarded to the upstream endpoint can be harmful, since response compression is quietly disabled. Why is this done?
I can imagine the short answer is: "If the developer wants to handle the response himself, Hapi can help him disabling the response compression". If so, I believe it's not a good idea to consider the presence of an onResponse handler to disable response compression. Wouldn't it be better creating a new option on proxy, like "disableResponseCompression: true|false"?
The text was updated successfully, but these errors were encountered: