nginx / unit

NGINX Unit - universal web app server - a lightweight and versatile open source server that simplifies the application stack by natively executing application code across eight different programming language runtimes.
https://unit.nginx.org
Apache License 2.0
5.25k stars 322 forks source link

Var: Fix cacheable issue for njs variable access. #1176

Closed hongzhidao closed 3 months ago

hongzhidao commented 3 months ago

The variables accessed with JS template literal should be not cacheable. Since it is parsed by njs engine, Unit can't create indexes on these variables for caching purpose. For example:

{ "format": "{bodyLength:\"${vars.body_bytes_sent}\",status:\"${vars.status}\"}\n" }

The variables like the above are not cacheable.

Closes: https://github.com/nginx/unit/issues/1169

hongzhidao commented 3 months ago

Hi @andrey-zelenkov, Please add a missing test on it, thanks.