Welcome! Log In Create A New Profile

Advanced

Inconsistent variable caching (in SSI or in nginScript)

Anton Yuzhaninov
October 09, 2017 10:18PM
Hello,

I've encountered a bug (or unexpected and not well documented feature)
in SSI (ngx_http_ssi_module) or in nginScript (ngx_http_js_module).

If a variable, which set via js_set is used only in SSI it is not cached
and nginScript function called several times for one HTTP request.

If the same variable is used anywhere in a config file, then a variable
value is cached (for a request).

Test config:

js_include /home/citrin/w/nginx/random.js;

js_set $random_int randomInt;

server {
listen 8081;

location / {
ssi on;
ssi_types text/plain;
default_type text/plain;
return 200 '<!--# echo var="random_int" -->\n<!--# echo
var="random_int" -->\n';
}

location /unrelated {
add_header X-rnd $random_int;
}
}


With a config above I see the same random number printed twice (as
expected).

But when an add_header directive is commented out I see two different
random numbers (and this change is not expected).

nginx version: nginx/1.12.1
nginx-module-njs 0.1.10

--
Best Regards,
Anton Yuzhaninov
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Inconsistent variable caching (in SSI or in nginScript)

Anton Yuzhaninov October 09, 2017 10:18PM

Re: Inconsistent variable caching (in SSI or in nginScript)

Anton Yuzhaninov October 10, 2017 10:24AM

Re: Inconsistent variable caching (in SSI or in nginScript)

Maxim Dounin October 10, 2017 10:42AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 210
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