]> git.kaiwu.me - njs.git/commit
HTTP: added js_access directive.
authorDmitry Volyntsev <xeioex@nginx.com>
Sat, 28 Mar 2026 00:33:37 +0000 (17:33 -0700)
committerDmitry Volyntsev <xeioexception@gmail.com>
Wed, 6 May 2026 00:50:59 +0000 (17:50 -0700)
commit8d571dd98677d69a27e3e0428bbaba3fe81ea792
tree9de7158bc96e03000a4d7c0a8fb03835aa88f4d5
parenta8a87b0eba23ae5f94f976870195ef03afdcbdc2
HTTP: added js_access directive.

The directive registers a JavaScript handler in the access phase,
running after built-in access checkers (allow/deny, auth_basic,
auth_request).  r.subrequest(), ngx.fetch() and other async operations
are supported.

The handler defaults to NGX_OK (access granted) on normal completion,
matching the behavior of other access phase modules.  The r.decline()
method allows the handler to return NGX_DECLINED (no opinion), deferring
the decision to other access checkers under "satisfy any".

The r.return() method can send any HTTP response from the access phase,
including 3xx redirects for authentication flows.
nginx/ngx_http_js_module.c
nginx/t/js_access.t [new file with mode: 0644]
nginx/t/js_access_satisfy.t [new file with mode: 0644]
ts/ngx_http_js_module.d.ts