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(aws-lambda) strip Connection header if client is using HTTP/2 #4032

Merged
merged 6 commits into from
Dec 3, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion kong/plugins/aws-lambda/handler.lua
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,12 @@ function AWSLambdaHandler:access(conf)
AWSLambdaHandler.super.access(self)

local upstream_body = new_tab(0, 6)
local var = ngx.var
rainest marked this conversation as resolved.
Show resolved Hide resolved

if conf.forward_request_body or conf.forward_request_headers
or conf.forward_request_method or conf.forward_request_uri
then
-- new behavior to forward request method, body, uri and their args
local var = ngx.var

if conf.forward_request_method then
upstream_body.request_method = var.request_method
Expand Down Expand Up @@ -230,6 +230,14 @@ function AWSLambdaHandler:access(conf)
local content = res:read_body()
local headers = res.headers

if var.http2 then
headers["Connection"] = nil
headers["Keep-Alive"] = nil
headers["Proxy-Connection"] = nil
headers["Upgrade"] = nil
headers["Transfer-Encoding"] = nil
end
Copy link
Member

Choose a reason for hiding this comment

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


local ok, err = client:set_keepalive(conf.keepalive)
if not ok then
return responses.send_HTTP_INTERNAL_SERVER_ERROR(err)
Expand Down