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

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

Open
yangzieric opened this issue Jun 18, 2019 · 0 comments
Open

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

yangzieric opened this issue Jun 18, 2019 · 0 comments

Comments

@yangzieric
Copy link

请教您一个问题,我目前遇到的问题我没有想到原因,希望您有时间可以帮我看一下。
目前我配置文 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

希望您能点醒梦中人!

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

No branches or pull requests

1 participant