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

request-size-limiting http2 requests are not supported without content-length header #12604

Closed
1 task
tomcatu opened this issue Feb 22, 2024 · 5 comments
Closed
1 task
Labels
breaking-change core/proxy pending author feedback Waiting for the issue author to get back to a maintainer with findings, more details, etc...

Comments

@tomcatu
Copy link

tomcatu commented Feb 22, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Kong version ($ kong version)

Kong 3.6

Current Behavior

2024/02/21 08:49:25 [error] 1278#0: *2740 [kong] init.lua:405 [request-size-limiting] /usr/local/share/lua/5.1/kong/pdk/request.lua:710: http2 requests are not supported without content-length header, request_id: "b96541373a593c1eca3b652d3678a268"

Expected Behavior

200

Steps To Reproduce

proxy_listen
0.0.0.0:8143 ssl reuseport backlog=16384 proxy_protocol http2

Anything else?

2024/02/21 08:49:24 [debug] 1279#0: *101 [lua] handler.lua:84: [otel] exporter sent 1 traces to in 1.0390000343323 seconds
2024/02/21 08:49:24 [debug] 1279#0: *101 [kong] queue.lua:185 [opentelemetry plugin 1dab527e-c428-4687-b7b6-da0b82dfe445] queue 1dab527e-c428-4687-b7b6-da0b82dfe445: handler processed 1 entries successfully
2024/02/21 08:49:24 [debug] 1279#0: *101 [kong] queue.lua:185 [opentelemetry plugin 1dab527e-c428-4687-b7b6-da0b82dfe445] queue 1dab527e-c428-4687-b7b6-da0b82dfe445: processing queue
2024/02/21 08:49:24 [debug] 1279#0: *101 [kong] queue.lua:185 [opentelemetry plugin 1dab527e-c428-4687-b7b6-da0b82dfe445] queue 1dab527e-c428-4687-b7b6-da0b82dfe445: passing 1 entries to handler
2024/02/21 08:49:24 [debug] 1279#0: *101 [lua] handler.lua:84: [otel] exporter sent 1 traces to in 0.30699992179871 seconds
2024/02/21 08:49:24 [debug] 1279#0: *101 [kong] queue.lua:185 [opentelemetry plugin 1dab527e-c428-4687-b7b6-da0b82dfe445] queue 1dab527e-c428-4687-b7b6-da0b82dfe445: handler processed 1 entries successfully
2024/02/21 08:49:24 [debug] 1279#0: *101 [kong] queue.lua:185 [opentelemetry plugin 1dab527e-c428-4687-b7b6-da0b82dfe445] queue 1dab527e-c428-4687-b7b6-da0b82dfe445: processing queue
2024/02/21 08:49:24 [debug] 1279#0: *101 [kong] queue.lua:185 [opentelemetry plugin 1dab527e-c428-4687-b7b6-da0b82dfe445] queue 1dab527e-c428-4687-b7b6-da0b82dfe445: passing 1 entries to handler
2024/02/21 08:49:24 [debug] 1279#0: *2737 [lua] consistent_hashing.lua:136: getPeer(): trying to get peer with value to hash: [60ecf6f85b92fc1e8a29290f]
2024/02/21 08:49:24 [debug] 1279#0: *2737 [lua] init.lua:1362: balancer(): setting address (try 1): 10.118.169.23:8088
2024/02/21 08:49:24 [debug] 1279#0: *2737 [lua] init.lua:1395: balancer(): enabled connection keepalive (pool=10.118.169.23|8088, pool_size=512, idle_timeout=60, max_requests=10000)
2024/02/21 08:49:24 [debug] 1279#0: *101 [lua] handler.lua:84: [otel] exporter sent 1 traces to in 0.30200004577637 seconds
2024/02/21 08:49:24 [debug] 1279#0: *101 [kong] queue.lua:185 [opentelemetry plugin 1dab527e-c428-4687-b7b6-da0b82dfe445] queue 1dab527e-c428-4687-b7b6-da0b82dfe445: handler processed 1 entries successfully
2024/02/21 08:49:24 [debug] 1279#0: *101 [kong] queue.lua:185 [opentelemetry plugin 1dab527e-c428-4687-b7b6-da0b82dfe445] queue 1dab527e-c428-4687-b7b6-da0b82dfe445: processing queue
2024/02/21 08:49:24 [debug] 1279#0: *101 [kong] queue.lua:185 [opentelemetry plugin 1dab527e-c428-4687-b7b6-da0b82dfe445] queue 1dab527e-c428-4687-b7b6-da0b82dfe445: passing 1 entries to handler
2024/02/21 08:49:25 [debug] 1278#0: *2739 [lua] init.lua:1362: balancer(): setting address (try 1): 10.118.169.32:3000
2024/02/21 08:49:25 [debug] 1278#0: *2739 [lua] init.lua:1395: balancer(): enabled connection keepalive (pool=10.118.169.32|3000, pool_size=512, idle_timeout=60, max_requests=10000)
2024/02/21 08:49:25 [debug] 1278#0: *2740 [lua] init.lua:1362: balancer(): setting address (try 1): 47.75.19.2:80
2024/02/21 08:49:25 [debug] 1278#0: *2740 [lua] init.lua:1395: balancer(): enabled connection keepalive (pool=47.75.19.2|80, pool_size=512, idle_timeout=60, max_requests=10000)
2024/02/21 08:49:25 [debug] 1278#0: *2740 [lua] init.lua:1362: balancer(): setting address (try 1): 47.75.19.2:80
2024/02/21 08:49:25 [debug] 1278#0: *2740 [lua] init.lua:1395: balancer(): enabled connection keepalive (pool=47.75.19.2|80, pool_size=512, idle_timeout=60, max_requests=10000)
2024/02/21 08:49:25 [error] 1278#0: *2740 [kong] init.lua:405 [request-size-limiting] /usr/local/share/lua/5.1/kong/pdk/request.lua:710: http2 requests are not supported without content-length header, request_id: "b96541373a593c1eca3b652d3678a268"
2024/02/21 08:49:25 [debug] 1278#0: *2740 [lua] handler.lua:168: [otel] total spans in current request: 7
2024/02/21 08:49:25 [debug] 1278#0: *2740 [lua] instrumentation.lua:383: runloop_log_after(): [tracing] collected 7 spans:
Span Kong/charts#1 name=kong duration=10.455296ms attributes={"net.peer.ip":"10.118.169.1","http.status_code":500"kong.request.id":"b96541373a593c1eca3b652d3678a268","http.method":"GET","http.flavor":"2.0","http.route":"/"}
Span Kong/charts#2 name=kong.rewrite.plugin.common duration=0.024832ms
Span Kong/charts#3 name=kong.router duration=2.858240ms
Span Kong/charts#4 name=kong.access.plugin.request-size-limiting duration=2.341632ms
Span Kong/charts#5 name=kong.header_filter.plugin.response-transformer duration=1.631232ms
Span Kong/charts#6 name=kong.header_filter.plugin.common duration=0.722688ms
Span Kong/charts#7 name=kong.header_filter.plugin.opentelemetry duration=0.004608ms
remote_addr=[47.76.81.204] http_x_forward=[-] time=[21/Feb/2024:08:49:25 +0000] request=[GET /rest/v1/logo/?domain_id=5a4b9c8f21c2a233713d4f5b HTTP/2.0] request_byte=[209] status=[500] response_byte=[1447] elapsed=[0.010] upstream_connect_time=[-] upstream_header_time=[-] upstream_response_time=[-] http_accept=[application/json, text/plain, /|gzip, deflate, br|en,zh-CN;q=0.9,zh;q=0.8] traceparent=[00-e0f3bbcd18178241f6aa3fcfb8df530f-224ce6c47d9b3568-01]
2024/02/21 08:49:25 [debug] 1278#0: *2740 [lua] init.lua:1362: balancer(): setting address (try 1): 10.118.169.23:8088
2024/02/21 08:49:25 [debug] 1278#0: *2740 [lua] init.lua:1395: balancer(): enabled connection keepalive (pool=10.118.169.23|8088, pool_size=512, idle_timeout=60, max_requests=10000)
2024/02/21 08:49:25 [debug] 1278#0: *2740 [lua] handler.lua:168: [otel] total spans in current request: 7
2024/02/21 08:49:25 [debug] 1278#0: *2740 [lua] instrumentation.lua:383: runloop_log_after(): [tracing] collected 7 spans:
Span Kong/charts#1 name=kong duration=5.509376ms attributes={"net.peer.ip":"10.118.169.1","http.status_code":500,"http.scheme":"https","kong.request.id":"1e23c22df4b393518f57340f11078d1c","http.method":"GET","http.flavor":"2.0","http.route":"/"}
Span Kong/charts#2 name=kong.rewrite.plugin.common duration=0.024320ms
Span Kong/charts#3 name=kong.router duration=0.169216ms
Span Kong/charts#4 name=kong.access.plugin.request-size-limiting duration=0.132096ms
Span Kong/charts#5 name=kong.header_filter.plugin.response-transformer duration=0.046080ms
Span Kong/charts#6 name=kong.header_filter.plugin.common duration=0.240640ms
Span Kong/charts#7 name=kong.header_filter.plugin.opentelemetry duration=0.007168ms
2024/02/21 08:49:25 [error] 1278#0: *2740 [kong] init.lua:405 [request-size-limiting] /usr/local/share/lua/5.1/kong/pdk/request.lua:710: http2 requests are not supported without content-length header server: kong, request: "GET /rest/ HTTP/2.0", request_id: "57f5b41f7010890cead4f172e1f8d75c"
2024/02/21 08:49:25 [debug] 1278#0: *2740 [lua] handler.lua:168: [otel] total spans in current request: 7
2024/02/21 08:49:25 [debug] 1278#0: *2740 [lua] instrumentation.lua:383: runloop_log_after(): [tracing] collected 7 spans:
Span Kong/charts#1 name=kong duration=11.509504ms attributes={"net.peer.ip":"10.118.169.1","http.status_code":500,"http.host":"kong.request.id":"57f5b41f7010890cead4f172e1f8d75c","http.method":"GET","http.flavor":"2.0","http.route":"/"}

@chobits
Copy link
Contributor

chobits commented Feb 26, 2024

hi this error message occurs as expected, because the Kong project expects or requires the Content-Length header to be present in this case, for functionality related to request size limiting. Otherwise request-size-limiting plugin could not work without knowing the content-lenght field

@StarlightIbuki StarlightIbuki added the pending author feedback Waiting for the issue author to get back to a maintainer with findings, more details, etc... label Feb 26, 2024
@vm-001
Copy link
Member

vm-001 commented Feb 26, 2024

The lua-nginx-module made some changes about this behavior, see
https://github.com/openresty/lua-nginx-module/pull/2237/files#diff-e5adfbc2ed61393c8309bee7f85b858a67d5b75e4f3201610504aa571bb44323R90-R93

A bypass way is to explicitly provide the Content-Length(regardless it's zero) header for GET

@tomcatu
Copy link
Author

tomcatu commented Feb 27, 2024

This involves requesting changes. Should the plug-in not check the GET request?

@vm-001
Copy link
Member

vm-001 commented Feb 27, 2024

I'm not saying that this is a reasonable workaround. It's just a theoretical bypass based on the root cause.

@oowl
Copy link
Member

oowl commented Feb 28, 2024

will be fixed in #12658

@tomcatu tomcatu closed this as completed Feb 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change core/proxy pending author feedback Waiting for the issue author to get back to a maintainer with findings, more details, etc...
Projects
None yet
Development

No branches or pull requests

6 participants