<div dir="ltr">Thanks, I'll check it out. Will get back to you in case of any queries.<div> <div>Additionally, I would like like to know the performance of NJS as we will be using this in production,</div><div>Which one has more performance - Lua or NJS ?</div><div><br></div></div><div>Please suggest here. </div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jun 3, 2019 at 11:33 PM Dmitry Volyntsev <<a href="mailto:xeioex@nginx.com">xeioex@nginx.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
<br>
On 03.06.2019 20:43, <a href="http://naidile.pn" rel="noreferrer" target="_blank">naidile.pn</a> wrote:<br>
> <br>
> I want to make a REST API call which is on a different server to fetch a <br>
> property.<br>
> <br>
> And add the property to the request from client and proxy it<br>
<br>
<br>
Currently you can do it using two sublocations with proxy_pass <br>
directives <br>
(<a href="http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_pass" rel="noreferrer" target="_blank">http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_pass</a>).<br>
<br>
--------------------<br>
function js_content(r) {<br>
<br>
r.subrequest("/property", reply => {<br>
<br>
if (reply.status != 200) { r.return(500, "prop failed"); return; }<br>
<br>
r.subrequest('/backend', res => {<br>
...<br>
})<br>
})<br>
}<br>
<br>
------------------<br>
<br>
We plan to add a Promise object this year, so in the future it will be <br>
less cumbersome.<br>
</blockquote></div>