44Unit 1.32.0 Released
55####################
66
7- Unit 1.31.0 introduced a Technology Preview of a WebAssembly language module
8- and an SDK for C and Rust, helping developers build and run web applications
9- compiled to Wasm. Although effective, we recognized that a custom low-level
10- ABI on the host side and a developer SDK for server-side WebAssembly marked
11- not the conclusion, but a significant milestone in our journey.
127
138Unit 1.32.0 comes with a new language module for WebAssembly that supports
149the WASI 0.2 HTTP world so that WebAssembly Components implementing this
15- Interface can be hosted on Unit.
10+ interface can be hosted on Unit.
11+
12+ This new language module improves upon the existing WebAssembly support. We
13+ recommend all users to use this new implementation for WebAssembly. We consider
14+ the old **unit-wasm ** module deprecated now.
1615
1716Additionally, we are adding the following features:
1817
19- - Enhanced the NJS experience by making all Unit variables accessible
20- from JavaScript
18+ - Enhanced the :doc: ` NJS (NGINX JavaScript) experience < ../../scripting >` by making all Unit variables
19+ accessible from JavaScript
2120
22- - Added support for conditional access logging
21+ - Added support for
22+ :ref: `conditional access logging <conditional-access-logging-news >`, to help
23+ you filter the requests that are logged
2324
2425- Added support for changing Unit's control socket permissions
2526
26- - Added a new variable **request_id **
27+ - Added a :ref: ` new variable < configuration-variables >`, **request_id **
2728
2829...and much more! Keep reading to learn more about what changed since 1.31.1.
2930
30- **********************
31- Unit is now on GitHub!
32- **********************
33-
34- This release is special! Special for us and the Community! As you may have
35- noticed we have moved more and more of our development and planning workloads
36- from our old systems to GitHub.
37-
38- GitHub is no longer just a read-only mirror. It now serves as the primary
39- source for our source code and tests. We invite you to create issues,
40- contribute through pull requests, or join our discussions. There are
41- many ways to get involved with us.
42-
43- We've also fully transitioned the development and maintenance of unit.nginx.org
44- to GitHub. We look forward to pull requests and issues that will improve our
45- documentation.
46-
4731************************************************************************
48- WebAssembly next-level : Support for Wasm components and the WASI 0.2 API
32+ WebAssembly: Support for Wasm components and the WASI 0.2 API
4933************************************************************************
5034
5135Since the release of Unit 1.31.0 in August 2023 and the announcement of our
5236technology preview for WebAssembly, a lot has changed an happened in the
5337WebAssembly ecosystem.
5438
5539So we evolved and with 1.32.0, we are happy to announce the support for the
56- WebAssembly Component Model using the WASI 0.2 APIs. This will open the
40+ WebAssembly Component Model using the WASI 0.2 APIs. This opens the
5741possibilities to run Wasm Components compatible with the WASI 0.2 APIs on Unit
5842without having a need to rebuild them. This is also the first Language Module
5943for Unit that was driven by the Community. Special thanks to Alex Crichton
6044for the contribution!
6145
62- You can find out more about this in our Blog post: WebAssembly Next-Level:
63- Support for Wasm Components
46+ We are preparing a blog post where we will dive deeper into the details of the
47+ new WebAssembly language module. Stay tuned!
6448
6549*******************************************************************
6650Enhanced scripting support - Use Unit-variables in NGINX JavaScript
6751*******************************************************************
6852
6953Using JavaScript in Unit's configuration unlocks almost endless opportunities.
7054A simple Unit configuration can be used to decide where a request should be
71- routed or rewritten to by creating the values for pass and rewrite dynamically
72- inside a JavaScript function.
55+ routed or rewritten to by creating the values for ** pass ** and ** rewrite **
56+ dynamically inside a JavaScript function.
7357
7458Previously JavaScript modules had access to a
7559:doc: `limited set of objects and scalars <../../scripting >`. Now JavaScript has
7660access to all of :ref: `Unit's variables <configuration-variables >` through
7761the vars object.
7862
79- In the following sample configuration, we set the Cache-Control header based on
80- the HTTP method. We do this by accessing the method variable as **vars.method **.
81- When the method starts with a "P" (POST, PUT, PATCH), we do not want to cache
82- the response. For all other methods we set a **max-age ** of 3600 seconds.
63+ In the following sample configuration, we set the **Cache-Control ** header
64+ based on the HTTP method. We do this by accessing the method variable as
65+ **vars.method **. When the method starts with a "P" (POST, PUT, PATCH),
66+ we do not want to cache the response. For all other methods we set a **max-age **
67+ of 3600 seconds.
8368
8469.. code-block :: json
8570
@@ -92,14 +77,60 @@ the response. For all other methods we set a **max-age** of 3600 seconds.
9277 }
9378 }
9479
80+
81+ .. _conditional-access-logging-news :
82+ **************************
83+ Conditional access logging
84+ **************************
85+
86+ Access logs are a great way to monitor the traffic sent to Unit.
87+ However, you might find that certain requests, such as regular
88+ health checks and automated UI tests, aren't ones you want
89+ cluttering up your logs. While these checks are crucial for monitoring
90+ the health of your services or web applications, they can significantly
91+ increase the volume of data in your access logs, leading to unnecessary noise.
92+
93+ With conditional access logging, you can define rules to decide if a request
94+ should be logged or not.
95+
96+ .. code-block :: json
97+
98+ {
99+ "access_log" : {
100+ "if" : " `${uri == '/health' ? false : true}`" ,
101+ "path" : " /var/log/unit/access.log" ,
102+ "format" : " `${host + ': ' + uri}`"
103+ }
104+ }
105+
106+ In this example we don't want to log any health checks sent to Unit.
107+ As shown in our example, to get the maximum out of the newly added **if **
108+ option, you can combine it with our JavaScript scripting feature, but this
109+ is not a must.
110+
111+ The **if ** option also supports simple string validation to check if a value
112+ is present in a request or not.
113+
114+ .. code-block :: json
115+
116+ {
117+ "access_log" : {
118+ "if" : " $cookie_session" ,
119+ "path" : " …"
120+ }
121+ }
122+
123+ In this example Unit will check the existence of a Cookie named session
124+ and only log requests when it exists.
125+
95126****************
96127CLI enhancements
97128****************
98129
99130The **unitc ** command line tool is a convenient way of applying and editing Unit
100131configuration without constructing lengthy **curl(1) ** commands or knowing where
101132the control socket is located. Unit 1.32.0 includes two useful enhancements to
102- **unitc ** that, included in the official packages.
133+ **unitc ** that are included in the official packages.
103134
104135A Docker container ID can now be specified as the configuration target.
105136To access the configuration of a local Unit container, use the **docker:// **
@@ -135,59 +166,49 @@ statistics from a Docker container:
135166 Note that the `yq(1) <https://github.com/mikefarah/yq#install >`__ tool is required
136167for YAML format conversion.
137168
138- **************************
139- Conditional access logging
140- **************************
141-
142- Access logs are a great way to monitor the traffic sent to Unit.
143- However, you might find that certain requests, such as regular
144- health checks and automated UI tests, aren't ones you want
145- cluttering up your logs. While these checks are crucial for monitoring
146- the health of your services or web applications, they can significantly
147- increase the volume of data in your access logs, leading to unnecessary noise.
148-
149- With conditional access logging, you can define rules to decide if a request
150- should be logged or not.
151-
152- .. code-block :: json
153169
154- {
155- "access_log" : {
156- "if" : " `${uri == '/health' ? false : true}`" ,
157- "path" : " /var/log/unit/access.log" ,
158- "format" : " `${host + ': ' + uri}`"
159- }
160- }
170+ **********************
171+ Unit is now on GitHub!
172+ **********************
161173
162- In this example we don't want to log any health checks sent to Unit.
163- Anything will be logged to the given file in the defined format as usual.
164- As shown in our example, to get the maximum out of the newly added **if **
165- option, you can combine it with our JavaScript scripting feature, but this
166- is not a must.
174+ This release is special! Special for us and the Community! As you may have
175+ noticed we have moved more and more of our development and planning workloads
176+ from our old systems to `GitHub <https://github.com/nginx/unit/ >`__.
167177
168- The **if ** option also supports simple string validation to check if a value
169- is present in a request or not.
178+ GitHub is no longer just a read-only mirror. It now serves as the primary
179+ source for our source code and tests. We invite you to create
180+ `issues <https://github.com/nginx/unit/issues >`__, contribute through
181+ `pull requests <https://github.com/nginx/unit/pulls >`__, or join our
182+ `discussions <https://github.com/nginx/unit/discussions >`__. There are many
183+ ways to get involved with us.
170184
171- .. code-block :: json
185+ We've also fully transitioned the development and maintenance of unit.nginx.org
186+ to the `Github unit-docs <https://github.com/nginx/unit-docs/ >`__ repository.
187+ We look forward to pull requests and issues that will improve our documentation.
172188
173- {
174- "access_log" : {
175- "if" : " $cookie_session" ,
176- "path" : " …"
177- }
178- }
189+ *************************************
190+ Changes in behavior and other updates
191+ *************************************
179192
180- In this example Unit will check the existence of a Cookie named session
181- and only log request including this cookie.
193+ ==========================================================================
194+ Docker image uses **stderr **, so now you can send **access_log ** to stdout
195+ ==========================================================================
182196
197+ With 1.32.0 the **unit.log ** file is symlinked to the container's
198+ **/dev/stderr ** instead of **/dev/stdout **. This leaves room for the
199+ *access_log * to be redirected to **/dev/stdout ** and will not populate
200+ the Unit log messages to **stdout ** which might be scraped by log collectors.
183201
202+ =======================================================
203+ unit.nginx.org/download/ is now sources.nginx.org/unit/
204+ =======================================================
184205
185- *************************************
186- Changes in behavior and other updates
187- *************************************
206+ We have moved the location of the Unit tarballs from "unit.nginx.org/download/"
207+ to a new, central source archive for NGINX:
208+ ` sources.nginx.org/unit/ < https://sources.nginx.org/unit/ >`__.
188209
189- - Docker image uses ** stderr ** (was ** stdout **) so now you can send ** access_log ** to stdout.
190- - Node JS Language Module enhancements
210+ The old link is currently proxying to the new location, but officially
211+ deprecated now! Please update to the new location "sources.nginx.org/unit/".
191212
192213************
193214Wall of fame
@@ -204,4 +225,62 @@ making Unit better! With 1.32.0 we would like to send a shout out to:
204225- Dean Coakley
205226- rustedsword
206227- Hippolyte Pello
207- - Javier Evans
228+ - Javier Evans
229+
230+ **************
231+ Full Changelog
232+ **************
233+
234+ .. code-block :: none
235+
236+ Changes with Unit 1.32.0 27 Feb 2024
237+
238+ *) Feature: WebAssembly Components using WASI interfaces defined in
239+ wasi:http/proxy@0.2.0.
240+
241+ *) Feature: conditional access logging.
242+
243+ *) Feature: NJS variables access.
244+
245+ *) Feature: $request_id variable contains a string that is formed using
246+ random data and can be used as a unique request identifier.
247+
248+ *) Feature: options to set control socket permissions.
249+
250+ *) Feature: Ruby arrays in response headers, improving compatibility
251+ with Rack v3.0.
252+
253+ *) Feature: Python bytearray response bodies for ASGI applications.
254+
255+ *) Bugfix: router could crash while sending large files. Thanks to
256+ rustedsword.
257+
258+ *) Bugfix: serving static files from a network filesystem could lead to
259+ error.
260+
261+ *) Bugfix: "uidmap" and "gidmap" isolation options validation.
262+
263+ *) Bugfix: abstract UNIX socket name could be corrupted during
264+ configuration validation. Thanks to Alejandro Colomar.
265+
266+ *) Bugfix: HTTP header field value encoding could be misinterpreted in
267+ Python module.
268+
269+ *) Bugfix: Node.js http.createServer() accepts and ignores the "options"
270+ argument, improving compatibility with strapi applications, among
271+ others.
272+
273+ *) Bugfix: ServerRequest.flushHeaders() implemented in Node.js module to
274+ make it compatible with Next.js.
275+
276+ *) Bugfix: ServerRequest.httpVersion variable format in Node.js module.
277+
278+ *) Bugfix: Node.js module handles standard library imports prefixed with
279+ "node:", making it possible to run newer Nuxt applications, among
280+ others.
281+
282+ *) Bugfix: Node.js tarball location changed to avoid build/install
283+ errors.
284+
285+ *) Bugfix: Go module sets environment variables necessary for building
286+ on macOS/arm64 systems.
0 commit comments