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

bug: http2 requests are not supported without content-length header #11362

Open
guliuliu1 opened this issue Jun 18, 2024 · 3 comments
Open

bug: http2 requests are not supported without content-length header #11362

guliuliu1 opened this issue Jun 18, 2024 · 3 comments

Comments

@guliuliu1
Copy link

Current Behavior

http2 requests are not supported without content-length header

Expected Behavior

200

Error Logs

[error] 11650#11650: 87319400 failed to run log_by_lua: /usr/local/apisix/apisix/utils/log-util.lua:188: http2 requests are not supported without content-length header
stack traceback:
[C]: in function 'get_body_file'
/usr/local/apisix/apisix/utils/log-util.lua:188: in function 'get_full_log'
/usr/local/apisix/apisix/utils/log-util.lua:243: in function 'get_log_entry'
/usr/local/apisix/apisix/plugins/loki-logger.lua:181: in function 'phase_func'
/usr/local/apisix/apisix/plugin.lua:1192: in function 'common_phase'
/usr/local/apisix/apisix/init.lua:872: in function 'http_log_phase'

Steps to Reproduce

bugfix: revert #2174 and #2237 due to http2 behavior break change #2286
openresty/lua-nginx-module#2286

Environment

APISIX version (3.9.0):
Operating system (run uname -a):
Linux localhost.localdomain 3.10.0-1160.el7.x86_64 #1 SMP Mon Oct 19 16:18:59 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
OpenResty / Nginx version (run openresty -V or nginx -V):
nginx version: openresty/1.25.3.1
built by gcc 9.3.1 20200408 (Red Hat 9.3.1-2) (GCC)
built with OpenSSL 3.2.0 23 Nov 2023
TLS SNI support enabled
configure arguments: --prefix=/usr/local/openresty/nginx --with-cc-opt='-O2 -DAPISIX_RUNTIME_VER=1.2.0 -DNGX_GRPC_CLI_ENGINE_PATH=/usr/local/openresty/libgrpc_engine.so -DNGX_HTTP_GRPC_CLI_ENGINE_PATH=/usr/local/openresty/libgrpc_engine.so -DNGX_LUA_ABORT_AT_PANIC -I/usr/local/openresty/zlib/include -I/usr/local/openresty/pcre/include -I/usr/local/openresty/openssl3/include' --add-module=../ngx_devel_kit-0.3.3 --add-module=../echo-nginx-module-0.63 --add-module=../xss-nginx-module-0.06 --add-module=../ngx_coolkit-0.2 --add-module=../set-misc-nginx-module-0.33 --add-module=../form-input-nginx-module-0.12 --add-module=../encrypted-session-nginx-module-0.09 --add-module=../srcache-nginx-module-0.33 --add-module=../ngx_lua-0.10.26 --add-module=../ngx_lua_upstream-0.07 --add-module=../headers-more-nginx-module-0.37 --add-module=../array-var-nginx-module-0.06 --add-module=../memc-nginx-module-0.20 --add-module=../redis2-nginx-module-0.15 --add-module=../redis-nginx-module-0.3.9 --add-module=../ngx_stream_lua-0.0.14 --with-ld-opt='-Wl,-rpath,/usr/local/openresty/luajit/lib -Wl,-rpath,/usr/local/openresty/wasmtime-c-api/lib -L/usr/local/openresty/zlib/lib -L/usr/local/openresty/pcre/lib -L/usr/local/openresty/openssl3/lib -Wl,-rpath,/usr/local/openresty/zlib/lib:/usr/local/openresty/pcre/lib:/usr/local/openresty/openssl3/lib' --add-module=/tmp/tmp.HkXszPkFpt/openresty-1.25.3.1/../mod_dubbo-1.0.2 --add-module=/tmp/tmp.HkXszPkFpt/openresty-1.25.3.1/../ngx_multi_upstream_module-1.2.0 --add-module=/tmp/tmp.HkXszPkFpt/openresty-1.25.3.1/../apisix-nginx-module-1.16.0 --add-module=/tmp/tmp.HkXszPkFpt/openresty-1.25.3.1/../apisix-nginx-module-1.16.0/src/stream --add-module=/tmp/tmp.HkXszPkFpt/openresty-1.25.3.1/../apisix-nginx-module-1.16.0/src/meta --add-module=/tmp/tmp.HkXszPkFpt/openresty-1.25.3.1/../wasm-nginx-module-0.7.0 --add-module=/tmp/tmp.HkXszPkFpt/openresty-1.25.3.1/../lua-var-nginx-module-v0.5.3 --add-module=/tmp/tmp.HkXszPkFpt/openresty-1.25.3.1/../grpc-client-nginx-module-v0.5.0 --add-module=/tmp/tmp.HkXszPkFpt/openresty-1.25.3.1/../lua-resty-events-0.2.0 --with-poll_module --with-pcre-jit --with-stream --with-stream_ssl_module --with-stream_ssl_preread_module --with-http_v2_module --with-http_v3_module --without-mail_pop3_module --without-mail_imap_module --without-mail_smtp_module --with-http_stub_status_module --with-http_realip_module --with-http_addition_module --with-http_auth_request_module --with-http_secure_link_module --with-http_random_index_module --with-http_gzip_static_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-threads --with-compat --with-stream --without-pcre2 --with-http_ssl_module

@kayx23
Copy link
Member

kayx23 commented Jun 19, 2024

relevant discussion #11302 (comment), fyi @nic-6443

@nic-6443
Copy link
Member

relevant discussion #11302 (comment), fyi @nic-6443

Got it, I now understand why this sentence was in the document at that time. This restriction does not come from the HTTP/2 or HTTP/3 standards, nor does it affect processing of the HTTP request itself. It is just that the logging plugin needs the content-length header to collect the HTTP body.

@dzc2009
Copy link

dzc2009 commented Sep 4, 2024

Turning off enable_tttp2 can solve this problem
enable_http2: false

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 📋 Backlog
Development

No branches or pull requests

4 participants