Yeah, the tcl code that can be found for this was done some twenty years ago and has not been maintained. However, you can utilise the iRule LX function instead. Here's some code I put together, which you can customise to your need (I don't know what you want to do with decoded value):
irule LX config:
tmsh list ilx
ilx global-settings {
debug-port-blacklist { 47019 54321 60000 }
}
ilx node-version 0.12 {
full-version 0.12.15
}
ilx node-version 6 {
default yes
full-version 6.9.1
}
ilx plugin decode_html_plugin {
extensions {
decode_html_extension { }
}
from-workspace test_lx_workspace
log-publisher local-db-publisher
node-version 6.9.1
staged-directory /var/ilx/workspaces/Common/test_lx_workspace
}
ilx workspace test_lx_workspace {
extensions {
decode_html_extension {
files {
index.js { }
node_modules { }
package.json { }
}
}
}
node-version 6.9.1
partition none
rules {
encode_html_irule { }
}
staged-directory /var/ilx/workspaces/Common/test_lx_workspace
version 13.1.0.6
}
index.js:
/* Log debug to /var/log/ltm? 0=none, 1=errors only, 2=verbose */
var debug = 2;
if (debug >= 2) {console.log('Running extension1 index.js');}
/* Import the f5-nodejs module. */
var objF5 = require('f5-nodejs');
var objDecode = require('he');
var ilx = new objF5.ILXServer();
ilx.addMethod('FuncDecodeHTML', function(req, res) {
console.log('Method Invoked, Arguments:', ilx.params());
var output = objDecode.decode(req.params());
if (debug >= 1) { console.log('Decoded value is:',`${output}`);}
res.reply(`${output}`);
});
ilx.listen();
which is called by the following irule "encode_html_irule":
when HTTP_RESPONSE {
if { [HTTP::header value "my_hebrew_header"] ne ""} {
set handle [ILX::init "decode_html_plugin" "decode_html_extension"]
set result ""
if {[catch {ILX::call $handle FuncDecodeHTML [HTTP::header value "my_hebrew_header"]} result]} {
Error handling for debugging.
log local0.error "Client - HTML decoding for Hebrew ILX failure: $result"
HTTP::respond 400 content "There has been an error."
return
} else {
log local0. "$result."
}
}
}
I have tested the the NPM package "he" to be working, but I can't really test the whole thing in my environment at this time.
[EDIT] Fixed the naming of the plugin and the extension.