What nginScript Is
nginScript is a robust implementation of much of JavaScript – the most useful parts for configuring NGINX. Some less-used parts of JavaScript and some less relevant built-in objects are not supported.

nginScript can be used for quick fixes, making NGINX configuration more convenient, and operations more efficient. But, because it runs at the application delivery level, it will also enable you to refactor your applications for greater long-term stability, security, and scale.

nginScript has two parts:

A custom virtual machine (VM) and byte-code compiler with a very fast startup and tear-down time. Blocking operations, such as an HTTP subrequest, can be suspended and resumed, in the same way as other blocking operations in JavaScript.

A configuration syntax that allows you to embed snippets of JavaScript in your NGINX configuration. These snippets are evaluated at runtime, as HTTP transactions proceed. You can create powerful conditional configurations, modify requests and responses on the fly, and adjust the internal operations of NGINX specifically for each request.

There are currently several popular JavaScript VMs out there, but they are optimized for use with the browser. The virtual machine for nginScript is focused on server requirements. We run a separate virtual machine for each request, so there’s no need for garbage collection. And an nginScript can be pre-empted so NGINX code can run.

Click to expand...

And the interesting possibilities we can do with nginScript

What nginScript Makes Possible
nginScript has a wide range of potential uses. The following capabilities are available today – and they will extend with time:

In the future, we’ll add more capabilities to nginScript and broaden its scope, so you can use it for tasks such as fixing application bugs, changing business rules, personalizing the user experience, and sharding requests across servers and aggregating the replies.