Nevermind my previous post. I solved it finally :)
location /foo {
rewrite_by_lua '
res = ngx.location.capture("/bar", {method = ngx.HTTP_POST, body = "jjj"})
res = ngx.location.capture("/bar", {method = ngx.HTTP_POST, body = res.body})
ngx.print(res.body)
';
}
location /bar {
proxy_pass http://wservers;
}
[vm ~]$ curl localhost:8080/bar -X POST --data 'hello'
UPSTREAM: hello :UPSTREAM
[vm ~]$ curl localhost:8080/foo -X POST --data 'hello'
UPSTREAM: UPSTREAM: jjj :UPSTREAM :UPSTREAM
Thank you so much!! You saved me a lot of time.