-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
fix(runloop): upstream ssl failure when plugins use response handler #11502
Merged
windmgc
merged 8 commits into
master
from
fix-FTI-5347-kong-response-subrequest-lost-client-ssl-info
Sep 19, 2023
Merged
fix(runloop): upstream ssl failure when plugins use response handler #11502
windmgc
merged 8 commits into
master
from
fix-FTI-5347-kong-response-subrequest-lost-client-ssl-info
Sep 19, 2023
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
If a plugin has response() handler, in `Kong.response` it will emits a subrequest by calling `ngx.location.capture("/kong_buffered_http", options)`. `ngx.location.capture` will create a new nginx request, so the overwritten ssl info (client key & cert etc.) get lost in the new nginx request. To fix this, those ssl info need to be re-set in the new request context. We choose to do this in the early rewrite phase of the new request before `Kong.balancer()` getting executed. [FTI-5347](https://konghq.atlassian.net/browse/FTI-5347)
catbro666
force-pushed
the
fix-FTI-5347-kong-response-subrequest-lost-client-ssl-info
branch
from
August 31, 2023 08:40
fede3ca
to
8c43536
Compare
oowl
reviewed
Sep 6, 2023
oowl
approved these changes
Sep 12, 2023
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
windmgc
deleted the
fix-FTI-5347-kong-response-subrequest-lost-client-ssl-info
branch
September 19, 2023 05:48
3 tasks
catbro666
added a commit
that referenced
this pull request
Sep 21, 2023
…11502) * fix(runloop): upstream ssl failure when plugins use response handler If a plugin has response() handler, in `Kong.response` it will emits a subrequest by calling `ngx.location.capture("/kong_buffered_http", options)`. `ngx.location.capture` will create a new nginx request, so the overwritten ssl info (client key & cert etc.) get lost in the new nginx request. To fix this, those ssl info need to be re-set in the new request context. We choose to do this in the early rewrite phase of the new request before `Kong.balancer()` getting executed. [FTI-5347](https://konghq.atlassian.net/browse/FTI-5347) (cherry picked from commit 54468c4)
windmgc
pushed a commit
that referenced
this pull request
Sep 21, 2023
Only some style clean for #11502, applying early return.
windmgc
pushed a commit
that referenced
this pull request
Sep 22, 2023
…11600) * fix(runloop): upstream ssl failure when plugins use response handler (#11502) * fix(runloop): upstream ssl failure when plugins use response handler If a plugin has response() handler, in `Kong.response` it will emits a subrequest by calling `ngx.location.capture("/kong_buffered_http", options)`. `ngx.location.capture` will create a new nginx request, so the overwritten ssl info (client key & cert etc.) get lost in the new nginx request. To fix this, those ssl info need to be re-set in the new request context. We choose to do this in the early rewrite phase of the new request before `Kong.balancer()` getting executed. [FTI-5347](https://konghq.atlassian.net/browse/FTI-5347) (cherry picked from commit 54468c4) * update nginx template in spec --------- Co-authored-by: Zhefeng C <[email protected]> Co-authored-by: Zhefeng Chen <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
If a plugin has response() handler, in
Kong.response
it will emits a subrequest by callingngx.location.capture("/kong_buffered_http", options)
.ngx.location.capture
will create a new nginx request, so the overwritten ssl info (client key & cert etc.) get lost in the new nginx request.To fix this, those ssl info need to be re-set in the new request context. We choose to do this in the early rewrite phase of the new request before
Kong.balancer()
getting executed.The normal flow is as below:
For the buffered_proxying case,
ngx.location.capture
will create a new request, so the flow diagram become:FTI-5347