njs and subrequests
Dmitry Volyntsev
xeioex at nginx.com
Mon Nov 19 13:28:09 UTC 2018
Hi Antoine,
>Is there any plan to have subrequest from ngx_http_js_module support
> external URLs ?
Nothing prevents you from making subrequests to external URLs.
https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_pass
https://nginx.org/en/docs/http/ngx_http_core_module.html#resolver
>The address can be specified as a domain name or IP address
..
>In this case, if an address is specified as a domain name, the name is
searched among the described server groups, and, if not found, is
determined using a resolver.
You still need a location to make a proxy_pass for you (what you already
have).
As Valentine said, there is nothing special in ngx_http_js_module about
subrequests. The module simply uses internal NGINX API for subrequests
(http://hg.nginx.org/njs/file/tip/nginx/ngx_http_js_module.c#l2099).
You, can find a more complex example of using njs subrequests here:
https://github.com/nginxinc/nginx-openid-connect
More information about the nginx
mailing list