carlosabalde/libvmod-cfg

used in backend_responce

redbox-cdn opened this issue · 3 comments

Hi, is it possible to use the variable in backend_responce?

sub vcl_backend_response {
 settings.get("test", "false");
}

best regards.

Hi @redbox-cdn,

Yes, it should be possible. Are you experiencing any problem?

Hi @carlosabalde

I consider use this vmod instead of vmod_var.
Because vmod_var could not set variable on backend section.
*varnish4 is separate client and backend section.

Now, I tested on our dev server. it works fine!

Thanks!

Just FYI: the var VMOD supports both local an global variables. As you said, local variables defined in e.g. vcl_recv won't be available in vcl_backend_* due to the split in client and backend threads since 4.0. However, scope of global variables is not constrained by that. In other words, var.global_*() functions will behave as expected.

Most important differences between the cfg VMOD and global variables in the var VMOD are: (1) unlike the var VMOD, the cfg VMOD does not support setting / updating variables; and (2) unlike the var VMOD, the cfg VMOD internally stores variables using a more efficient data structure (linked list vs. Red-Black tree), therefore is more suitable to handle large amounts of variables.