Skip to content
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(patchs): fix kong.request.enable_buffering PDK function cannot be used when dowstream uses HTTP/2. #13614

Open
wants to merge 15 commits into
base: master
Choose a base branch
from

Conversation

oowl
Copy link
Member

@oowl oowl commented Sep 4, 2024

Summary

  1. kong.request.enable_buffering PDK function can work fine when downstream using HTTP/2, which also means all of the kong plugins including the response function phase now work in HTTP2 protocol.
  2. Remove http2 hardcode limitation in ngx.location subrequest API by patch bugfix: remove http2 hardcode limitation in ngx.location subrequest API openresty/lua-nginx-module#2355
  3. Extend kong test helpers function helpers.proxy_ssl_client and helpers.proxy_clien http2 protocol support by https://github.com/oowl/lua-reqwest
  4. Improve some of the http2 downstream protocol tests in our test cases. eg: spec/03-plugins/38-ai-proxy/* and spec/02-integration/05-proxy/24-buffered_spec.lua

Checklist

  • The Pull Request has tests
  • A changelog file has been created under changelog/unreleased/kong or skip-changelog label added on PR if changelog is unnecessary. README.md
  • There is a user-facing docs PR against https://github.com/Kong/docs.konghq.com - PUT DOCS PR HERE

Issue reference

AG-108
FTI-5725

@oowl oowl force-pushed the openresty-remove-http2-hardcode-limitation-in-ngx-location branch from 9972720 to 9b1e3bc Compare September 4, 2024 07:02
@github-actions github-actions bot added build/bazel cherry-pick kong-ee schedule this PR for cherry-picking to kong/kong-ee labels Sep 4, 2024
@oowl oowl force-pushed the openresty-remove-http2-hardcode-limitation-in-ngx-location branch from 9b1e3bc to fc3d3fb Compare September 4, 2024 07:32
@oowl oowl marked this pull request as draft September 4, 2024 08:39
@bungle
Copy link
Member

bungle commented Sep 4, 2024

@oowl what has been upstream answer to this? I guess they ended up adding it at some point (the limitation), but have it been changed there since? What are the unknowns?

@bungle
Copy link
Member

bungle commented Sep 4, 2024

@bungle
Copy link
Member

bungle commented Sep 4, 2024

@oowl can you also check your example with SSL/TLS connection just to be sure (it is rather pointless to do h2 without SSL/TLS):
openresty/lua-nginx-module#2243 (comment)

@oowl
Copy link
Member Author

oowl commented Sep 4, 2024

@oowl can you also check your example with SSL/TLS connection (it is rather pointless to do h2 without SSL/TLS): openresty/lua-nginx-module#2243 (comment)

Yeah, I will.
I will also complement some http2-related tests in our plugin and pdk integration test to verify that this patch works fine in our case. Let's wait for my good news

@pull-request-size pull-request-size bot added size/L and removed size/S labels Sep 5, 2024
@oowl oowl force-pushed the openresty-remove-http2-hardcode-limitation-in-ngx-location branch from 626d838 to 7730d13 Compare September 10, 2024 15:54
Copy link
Member

@bungle bungle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some comments. I like this a lot if it works! Good work on reqwest too!

spec/helpers.lua Outdated Show resolved Hide resolved
spec/helpers.lua Outdated Show resolved Hide resolved
spec/helpers.lua Outdated Show resolved Hide resolved
spec/helpers.lua Outdated Show resolved Hide resolved
spec/helpers.lua Outdated Show resolved Hide resolved
@oowl oowl changed the title fix(patchs): remove openresty http2 hardcode limitation in ngx.locati… fix(patchs): fix kong.request.enable_buffering PDK function cannot be use issue when dowstream is using HTTP/2. Sep 11, 2024
@oowl oowl changed the title fix(patchs): fix kong.request.enable_buffering PDK function cannot be use issue when dowstream is using HTTP/2. fix(patchs): fix kong.request.enable_buffering PDK function cannot be used when dowstream uses HTTP/2. Sep 11, 2024
@oowl oowl marked this pull request as ready for review September 11, 2024 07:33
@oowl
Copy link
Member Author

oowl commented Sep 11, 2024

Once it got 2 approved. I will squash my commit to 3 separate commits that can be merged by the rebase and merge button.

Makefile Outdated Show resolved Hide resolved
Copy link
Member

@bungle bungle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@oowl oowl force-pushed the openresty-remove-http2-hardcode-limitation-in-ngx-location branch from fe605b0 to a145fb0 Compare September 11, 2024 07:55
@@ -0,0 +1,4 @@
message: |
Fixed an issue where the `kong.request.enable_buffering` cannot be used when dowstream use HTTP/2.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Fixed an issue where the `kong.request.enable_buffering` cannot be used when dowstream use HTTP/2.
Fixed an issue where the `kong.request.enable_buffering` can not be used when dowstream uses HTTP/2.

local proxy_ip = get_proxy_ip(true, true)
local proxy_port = get_proxy_port(true, true)
local ihttp_version
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does the prefix i mean? Could we have a better name?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i means inner, to avoid the same variable name with the last function parameters. Do you have a better name in here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it is only used in opts, how about opts_http_version?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build/bazel cherry-pick kong-ee schedule this PR for cherry-picking to kong/kong-ee core/pdk size/L
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants