Release of nginx 1.19.7, njs 0.5.1, and NGINX Unit 1.22.0

The release of the main branch of nginx 1.19.7 has been formed, which continues to develop new capabilities (the parallel stable branch 1.18 only receives changes related to fixing serious bugs and vulnerabilities).

Key Changes:

  • When all available connections are exhausted, nginx now closes not only keepalive connections but also connections in a lingering close state.
  • The connection handling code in HTTP/2 is aligned with the implementation of HTTP/1.x. Support for separate settings 'http2_recv_timeout', 'http2_idle_timeout', and 'http2_max_requests' has been discontinued in favor of the general directives 'keepalive_timeout' and 'keepalive_requests'.
  • The settings 'http2_max_field_size' and 'http2_max_header_size' have been removed, and 'large_client_header_buffers' should be used instead.

At the same time, the release of njs 0.5.1 occurred, a JavaScript interpreter for web servers nginx. The njs interpreter implements ECMAScript standards and allows extending nginx's capabilities for request processing through scripts in the configuration. Scripts can be used in the configuration file to define advanced request handling logic, configuration creation, dynamic response generation, request/response modification, or quickly creating stubs to resolve issues in web applications.

The new version introduces the 'js_header_filter' directive, allowing a JavaScript function to filter and modify arbitrary response headers: js_import foo.js; location / { js_header_filter foo.filter; proxy_pass http://127.0.0.1:8081/; } foo.js: function filter(r) { var cookies = r.headersOut['Set-Cookie']; var len = r.args.len ? Number(r.args.len) : 0; r.headersOut['Set-Cookie'] = cookies.filter(v=>v.length > len); } export default {filter};

The ngx.fetch() method has also been added, which implements the Fetch API, providing HTTP client functionality. The method supports processing options body, headers, buffer_size, and max_response_body_size. The returned Response object supports methods arrayBuffer(), bodyUsed, json(), headers, ok, redirect, status, statusText, text(), type, and url, while the Header object supports methods get(), getAll(), and has(). function fetch(r) { ngx.fetch('http://nginx.org/') .then(reply => reply.text()) .then(body => r.return(200, body)) .catch(e => r.return(501, e.message)); }

It is also worth noting the publication server NGINX Unit 1.22 offers a solution for running web applications in various programming languages (Python, PHP, Perl, Ruby, Go, JavaScript/Node.js, and Java). Under NGINX Unit, multiple applications in different programming languages can run simultaneously, with launch parameters that can be changed dynamically without the need to edit configuration files or restart the server. The code is written in C and is distributed under the Apache 2.0 license.

The new release of NGINX Unit focuses on improving stability, expanding testing tools, and fixing bugs. In the Linux packages being generated, the user and group under which NGINX Unit runs have been changed. Instead of nobody:nobody, processes now run under a separate user 'unit' in the 'unit' group. Compatibility with the Stream API objects ServerRequest and ServerResponse from the Node.js module has been ensured. The 'path' option for Python applications now allows the specification of multiple directories.

Source: opennet.ru

Buy reliable website hosting with DDoS protection, VPS VDS servers 🔥 Buy reliable website hosting with DDoS protection, VPS VDS servers | ProHoster