Skip to content

ngx.location.capture 内部请求乱码 #33

@yangzieric

Description

@yangzieric

请教您一个问题,我目前遇到的问题我没有想到原因,希望您有时间可以帮我看一下。
目前我配置文 drizzle ,在 nginx 配置好了 location 直接访问是可以的,但是通过 ngx.location.capture 访问 有乱码。搞不清楚原因。

           nginx 配置文件:
                   upstream mysql {
                              drizzle_server 127.0.0.1:3306 dbname=cinema user=root password=123456 protocol=mysql charset=utf8;
                              drizzle_keepalive max=200 overflow=ignore mode=single;
                     }

 location /abc {
    set_quote_sql_str $id $arg_id;
    drizzle_query 'select c_ip as CIP,c_name as CName,c_num as CNum from c_info where c_status=0 and c_num in (14033071,44012501)';
    drizzle_pass mysql;
    rds_json on;
}

    location /qwe {
         default_type 'text/plain';
         content_by_lua_file '/data0/app/nginx/conf/lua/get_sql.lua';
    }

      cat get_sql.lua >>>

        local res = ngx.location.capture("/abc")
       if res.status == 200 then
             ngx.say(res.body)
       end

        nginx  版本   Tengine/2.1.2             

curl "http://127.0.0.1/abc"
[{"CIP":"10.255.126.34","CName":"中国第一家","CNum":12345678},{"CIP":"10.255.137.200","CName":"中国第二家","CNum":223456789}]

curl "http://127.0.0.1/qwe"
�cinemaIP��
10.255.126.34中国第一家 1234567810.255.137.200中国第二家 23456789

希望您能点醒梦中人!

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