NJS - API Calls

naidile.pn naidilepn at gmail.com
Mon Jun 3 17:46:38 UTC 2019


Adding, Basically a HTTP ajax call in JS

On Mon, Jun 3, 2019 at 11:13 PM naidile.pn <naidilepn at gmail.com> wrote:

> Thanks Dmitry.
>
> I want to make a REST API call which is on a different server to fetch a
> property.
>
> And add the property to the request from client and proxy it
>
> On Mon, Jun 3, 2019 at 11:09 PM Dmitry Volyntsev <xeioex at nginx.com> wrote:
>
>>
>>
>> On 03.06.2019 20:27, naidile.pn wrote:
>> > Hi Team,
>> >
>> > Can you please let me know how to make external API calls within the JS
>> > method.
>>
>>
>> Hi Naidile,
>>
>> what do you mean by external API calls?
>>
>>
>> > I actually want to make API calls and modify the request before proxy
>> > passing th e request to a up stream server.
>>
>>
>> It is considered to a bad practice to modify client request directly.
>> Instead you can create a subrequest
>> (http://nginx.org/en/docs/njs/reference.html#subrequest) and modify it
>> in a sublocation. See as an example
>> https://github.com/xeioex/njs-examples#subrequests-join
>>
>> >
>> > Thanks,
>> > Naidile
>> >
>> > _______________________________________________
>> > nginx-devel mailing list
>> > nginx-devel at nginx.org
>> > http://mailman.nginx.org/mailman/listinfo/nginx-devel
>> >
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20190603/6c6ff248/attachment.html>


More information about the nginx-devel mailing list