apache / apisix

The Cloud-Native API Gateway
https://apisix.apache.org/blog/
Apache License 2.0
14.54k stars 2.52k forks source link

bug: node-status plugin doesn't work with https #11223

Open madhawa-gunasekara opened 6 months ago

madhawa-gunasekara commented 6 months ago

Current Behavior

node-status plugin works fine with http calls but It fails with https.

current response for https :

`

500 Internal Server Error

500 Internal Server Error


openresty

Powered by APISIX.

`

Expected Behavior

{"status":{"handled":"160","total":"231","writing":"6","waiting":"2","active":"8","reading":"0","accepted":"160"},"id":"3642510e-605a-484a-aede-654be7674499"}

Error Logs

2024/05/03 09:12:39 [error] 35#35: *17249 lua entry thread aborted: runtime error: /usr/local/apisix/apisix/plugins/node-status.lua:48: http2 requests not supported yet stack traceback: coroutine 0: [C]: in function 'ngx_capture' /usr/local/apisix/apisix/plugins/node-status.lua:48: in function 'handler' /usr/local/apisix/apisix/api_router.lua:72: in function 'handler' /usr/local/apisix//deps/share/lua/5.1/resty/radixtree.lua:1013: in function 'dispatch' /usr/local/apisix/apisix/api_router.lua:111: in function 'match' /usr/local/apisix/apisix/plugins/public-api.lua:47: in function 'phase_func' /usr/local/apisix/apisix/plugin.lua:1155: in function 'run_plugin' /usr/local/apisix/apisix/init.lua:729: in function 'http_access_phase'

Steps to Reproduce

  1. enable https protocol in apisix
  2. enable node-status plugin with route apisix/status
  3. invoke the request with https protocol GET/apisix/status

Environment

hanqingwu commented 6 months ago

Yes, I can reproduce in apisix 3.9.0 . If you use curl --http1.1 will works .
Fix it need time .

hanqingwu commented 6 months ago

By check nginx source code, I think it still not fix . https://github.com/openresty/lua-nginx-module/blob/master/src/ngx_http_lua_headers.c#L142

#if (NGX_HTTP_V2)
    if (mr->stream) {
        return luaL_error(L, "http2 requests not supported yet");
    }
#endif

Some one try use httpc:request_uri instead of ngx.location.capture

https://github.com/openresty/lua-nginx-module/issues/1195