Answer the question
In order to leave comments, you need to log in
Unreadable response from res = ngx.location.capture; res.body with unreadable characters. How about?
php returns json data in the response: {"success":true,"key1":1,"key2":2}
and when I try to display nginx res.body, I get unreadable characters
nginx config:
location /IdentityAccess/loginService {
rewrite ^/IdentityAccess^/ /$1 break;
proxy_pass http://identityaccess/login;
proxy_redirect off;
}
location /IdentityAccess/login {
lua_need_request_body on;
content_by_lua '
local res = ngx.location.capture("/IdentityAccess/loginService",{ method = ngx.HTTP_POST,body=ngx.var.request_body })
if res then
nxg.var.resbody = res.body
ngx.say("status: ", res.status)
ngx.say("body:", res.body)
else
ngx.say("error")
end
';
}
Answer the question
In order to leave comments, you need to log in
Well, judging by the screenshot, the problem is with the encoding. And they directly checked, i.e. just raise with php -S raise and see?
no, haven't tried it.
but called /IdentityAccess/loginService - and there the response is readable as needed
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question