Inconsistent variable caching (in SSI or in nginScript)

Anton Yuzhaninov citrin at citrin.ru
Tue Oct 10 14:22:50 UTC 2017


On 10/09/17 22:15, Anton Yuzhaninov wrote:
> 
> 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.

This problem is not related to nginScript.

More simple test case:

    log_format unused '$request_id'; # when this line is commented
variable is not cached

    server {
        listen 8082;

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

If $request_id is used only in SSI two different $request_id values are
shown. If $request_id used anywhere in the config file - variable value
is cached and two same values are show.


More information about the nginx mailing list