]> git.kaiwu.me - njs.git/commit
HTTP: fixed r.return() with body in js_access.
authorDmitry Volyntsev <xeioex@nginx.com>
Thu, 14 May 2026 02:06:24 +0000 (19:06 -0700)
committerDmitry Volyntsev <xeioexception@gmail.com>
Fri, 15 May 2026 01:17:31 +0000 (18:17 -0700)
commit26a79e5307a07a2c4ec92acbd9d978f1a7b991cc
treeef52a106c0934b541b5f07d741bf2f2314845d66
parent92cc0e61bc9b167d6b375ae640ceb6b2a8572378
HTTP: fixed r.return() with body in js_access.

Previously, when a js_access handler called r.return(status, body),
ngx_http_send_response() sent the response but returned NGX_OK.  The
access handler then returned NGX_OK to the phase engine, which treated
the access check as allowed and continued to the content phase.

As a result, a denied request could still reach proxy_pass or another
content handler after the response had already been sent.

Now the access handler finalizes the request if a response was already
sent during js_access execution.  This keeps r.return() behavior in
js_content unchanged, while making r.return(status, body) terminal in
js_access.
nginx/ngx_http_js_module.c
nginx/t/js_access.t