Welcome! Log In Create A New Profile

Advanced

Re: njs and subrequests

Dmitry Volyntsev
November 19, 2018 08:30AM
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

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

njs and subrequests

Antoine Bonavita November 17, 2018 09:08AM

Re: njs and subrequests

Valentin V. Bartenev November 17, 2018 10:18AM

Re: njs and subrequests

Antoine Bonavita November 18, 2018 10:08AM

Re: njs and subrequests

Valentin V. Bartenev November 22, 2018 03:12PM

Re: njs and subrequests

Antoine Bonavita November 26, 2018 04:32AM

Re: njs and subrequests

Dmitry Volyntsev November 19, 2018 08:30AM

Re: njs and subrequests

Antoine Bonavita November 21, 2018 02:40PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 322
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready