From: Alexander Borisov Date: Thu, 8 Oct 2020 15:47:04 +0000 (+0300) Subject: HTTP: throwing an exception in internalRedirect() for a subrequest. X-Git-Url: http://git.kaiwu.me/postgresql/log/contrib/postgres_fdw/%7B@url%7D?a=commitdiff_plain;h=dd7ab069c801dc83cfc0222cc692c34c7d248da1;p=njs.git HTTP: throwing an exception in internalRedirect() for a subrequest. This closes #214 issue on GitHub. --- diff --git a/nginx/ngx_http_js_module.c b/nginx/ngx_http_js_module.c index e9132fd8..4e2f0077 100644 --- a/nginx/ngx_http_js_module.c +++ b/nginx/ngx_http_js_module.c @@ -1831,6 +1831,11 @@ ngx_http_js_ext_internal_redirect(njs_vm_t *vm, njs_value_t *args, return NJS_ERROR; } + if (r->parent != NULL) { + njs_vm_error(vm, "internalRedirect cannot be called from a subrequest"); + return NJS_ERROR; + } + ctx = ngx_http_get_module_ctx(r, ngx_http_js_module); if (ngx_http_js_string(vm, njs_arg(args, nargs, 1), &uri) != NJS_OK) {