8000 使用 Lua 模块的 ngx.location.capture 时 504 · Issue #1991 · alibaba/tengine · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
使用 Lua 模块的 ngx.location.capture 时 504 #1991
Open
@yelili422

Description

@yelili422

Ⅰ. Issue Description

使用 Lua 模块的 ngx.location.capture api 时报错 504

Ⅱ. Describe what happened

Ⅲ. Describe what you expected to happen

Ⅳ. How to reproduce it (as minimally and precisely as possible)

  1. 编译条件
./configure --prefix=/etc/nginx \
  --sbin-path=/usr/sbin/nginx \
  --modules-path=/usr/lib/nginx/modules \
  --conf-path=/etc/nginx/nginx.conf \
  --with-ld-opt='-Wl,-rpath,/usr/local/luajit/lib,--as-needed -pie' \
  --add-module=modules/ngx_http_lua_module \
            --with-debug --with-cc-opt='-g -O0'
  1. nginx 配置
location /test {
           content_by_lua_block {
                local res = ngx.location.capture("/backend", { method = ngx.HTTP_GET, body = "" })
                if res.status == 200 then
                    ngx.say("Backend response: ", res.body)
                else
                    ngx.status = res.status
                    ngx.say("Error: ", res.status)
                end
            }
}

location /backend {
    proxy_pass http://127.0.0.1:8080;
}
  1. curl 测试
curl http://localhost/test
Error: 504

Ⅴ. Anything else we need to know?

Ⅵ. Environment:

  • Tengine version (use sbin/nginx -V):
    Tengine version: Tengine/3.1.0
    nginx version: nginx/1.24.0
    built by gcc 12.2.0 (Debian 12.2.0-14)
    built with OpenSSL 3.0.15 3 Sep 2024
    TLS SNI support enabled
    configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib/nginx/modules --conf-path=/etc/nginx/nginx.conf --with-ld-opt='-Wl,-rpath,/usr/local/luajit/lib,--as-needed -pie' --add-module=modules/ngx_http_lua_module --with-debug --with-cc-opt='-g -O0'
  • OS (e.g. from /etc/os-release):
    PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
    NAME="Debian GNU/Linux"
    VERSION_ID="12"
    VERSION="12 (bookworm)"
    VERSION_CODENAME=bookworm
  • Kernel (e.g. uname -a):
  • Others:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0