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, within which the development of new features continues (only changes related to the elimination of serious errors and vulnerabilities are made in the parallel supported stable branch 1.18).

Major changes:

  • When a worker process runs out of free connections, nginx now closes not only keepalive connections, but also connections in the state of waiting for the socket to close (β€œlingering close”).
  • The connection handling code in HTTP/2 is close to the implementation of HTTP/1.x. Support for individual settings "http2_recv_timeout", "http2_idle_timeout" and "http2_max_requests" has been deprecated in favor of the general "keepalive_timeout" and "keepalive_requests" directives.
  • Removed "http2_max_field_size" and "http2_max_header_size" settings, instead "large_client_header_buffers" should be used.

At the same time, njs 0.5.1, a JavaScript interpreter for the nginx web server, was released. The njs interpreter implements the ECMAScript standards and allows you to extend nginx's ability to process requests using scripts in the configuration. Scripts can be used in a configuration file to define advanced request processing logic, generate a configuration, dynamically generate a response, modify a request/response, or quickly create problem-solving stubs in web applications.

The new version adds the "js_header_filter" directive, which allows you to set a JavaScript function to filter and change 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};

Also added is the ngx.fetch() method, which implements the Fetch API, which provides HTTP client functionality. The method supports handling the body, headers, buffer_size and max_response_body_size options. The returned Response object supports the arrayBuffer(), bodyUsed, json(), headers, ok, redirect, status, statusText, text(), type, and url methods, while the Header object supports the get(), getAll(), and has() methods. . 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)); }

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

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

Source: opennet.ru

Add a comment