-
Notifications
You must be signed in to change notification settings - Fork 338
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
Simple change to remove hop-by-hop headers when relaying respon… #921
Simple change to remove hop-by-hop headers when relaying respon… #921
Conversation
Oh ok — interesting issue. The fix seems legit, however I would like to check it out deeply before I can merge and release this. Thanks for the good investigation! |
No problem @XVincentX. It might be appropriate make this fix for other "hop-by-hop" headers as well, but did not investigate which other might cause an issue too.
|
Yeah that is exactly my point — more investigation might be required to make this work properly in all the circumstances. |
Good. Let me know if I can help. I you want to remove all hop-by-hop headers as a part of this pull request, I can make the appropriate updates. |
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.
Ok I've read a little bit around and yes, we should be removing these headers in case
- The http-server is in Proxy mode
- The hop-by-hop header is not being returned as part of the mocked response
Would you be willing to complete the PR with such changes and add the relative tests @rogersolsvik
packages/http-server/src/__tests__/header-params-validity.spec.ts
Outdated
Show resolved
Hide resolved
2daad7c
to
90ad5e4
Compare
A little premature push. Will be fixing test soon |
…in the forwarder. This also to ensure these headers are only removed when proxying. Added test to verify.
90ad5e4
to
f9bf1a1
Compare
I have not setup the harness tests locally. Any input on what's going wrong @XVincentX ? |
Did an update from master now which triggered a rebuild. The harness tests seem to work now. |
Thanks for checking this out — Ill review. |
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.
Some comments — check them out if you have time or I can make it over the finish line
@rogersolsvik Thanks for the follow up. I'll check it out again but I think this might be good to merge now. Thanks! |
fdbc1c2
to
3d5ff88
Compare
Thanks, @rogersolsvik |
…se from upstream
Checklist
What kind of change does this PR introduce?
Bug fix
What is the current behavior? What is the new behavior?
When running
prism proxy
it relays all headers from upstream source, even after adding new ones that might be incompatible with the original response.More specifically in my case, my application is sending the
Transfer-Encoding: chunked
header, but since Prism is buffering the whole response to do response validation, is also adds theContent-Length
header. These headers are incompatible and causes certain clients to fail. For example, Postman fails with a «Parse error» without a decent cause description.Read more about the
Transfer-Encoding
header hereDoes this PR introduce a breaking change?
Should be no breaking changes with this PR as far as I can see