Nginscript

Dmitry Volyntsev xeioex at nginx.com
Wed Nov 28 14:31:20 UTC 2018



On 28.11.2018 3:21, chadhasumit13 wrote:
> Hi, I intend to generate a unique id (by making use of npm uuid ) and make
> an external call to an HTTP end-point, whenever a new call is received by
> NGINX.
> 
> Is it possible to use nginscript for this purpose?
> 
> If yes, could you please route me to a good example by means of which I can
> fulfil the above-mentioned requirement.

Hi chadhasumit13,

Could you please clarify more what are you trying to do?


1) In general, if you simply need a unique id (not necessarily uuid), it 
is better and easier to use request_id variable 
(https://nginx.org/en/docs/http/ngx_http_core_module.html#var_request_id)

you can access $request_id variable by

r.variables.request_id

> external call to an HTTP end-point

2) You can use subrequest method 
(http://nginx.org/en/docs/njs/reference.html#http).

You can find some examples with it here:
https://github.com/xeioex/njs-examples#subrequests-join



More information about the nginx mailing list