JavaScript Streaming Configuration

Our experiments have found that anywhere from 10% to 50% of a given JavaScript source file is not actually needed in the context that it is deployed – a particular browser on a particular platform. By identifying such code and dividing the JavaScript appropriately, we are able to reduce the number of bytes of data that need to be transferred for the JavaScript to execute on the client, which can translate to significant improvements in browser performance.

For further details on JavaScript Streaming, read the document What is JavaScript Streaming?

There is only one user-configurable parameter for JavaScript Streaming – it is either enabled or not using an op block inside a js_stream block.

The following example shows JavaScript Streaming enabled in a performance rule. The expression matches when the request path string ends with the .js extension.

{
  "then_action": {
    "js_stream": {
      "op": {
        "enable": true
      }
    }
  },
  "id": "enable_jss",
  "predicate": "string.wildcard_match(string.lower($request.path),{\"*.js\"}) == true",
  "description": "enable jss"
}