njs-0.9.1

2025-07-10 Thread Dmitry Volyntsev
Hello, I'm glad to announce a new release of NGINX JavaScript module (njs). This release adds Fetch API support to the QuickJS engine, bringing it to feature parity with njs. Additionally, the shared dictionary now includes state file support, allowing its contents to persist across nginx restar

njs-0.9.0

2025-05-06 Thread Dmitry Volyntsev
Hello, I'm glad to announce a new release of NGINX JavaScript module (njs). This release features a 30% performance improvement for the njs engine and support for GCC 15. Learn more about njs: - Overview and introduction:   https://nginx.org/en/docs/njs/ - NGINX JavaScript in Your Web Serv

njs-0.8.10

2025-04-08 Thread Dmitry Volyntsev
Hello, I'm glad to announce a new release of NGINX JavaScript module (njs). This release introduced WebCrypto API, TextEncoder, TextDecoder, crypto, querystring, xml modules for QuickJS engine. Learn more about njs: - Overview and introduction:   https://nginx.org/en/docs/njs/ - NGINX Java

njs-0.8.9

2025-01-14 Thread Dmitry Volyntsev
Hello, I'm glad to announce a new release of NGINX JavaScript module (njs). This release introduced file system module for QuickJS engine. Learn more about njs: - Overview and introduction:   https://nginx.org/en/docs/njs/ - NGINX JavaScript in Your Web Server Configuration:   https://

njs-0.8.8

2024-12-10 Thread Dmitry Volyntsev
Hello, I'm glad to announce a new release of NGINX JavaScript module (njs). This release introduced shared dictionary for QuickJS engine. Learn more about njs: - Overview and introduction:   https://nginx.org/en/docs/njs/ - NGINX JavaScript in Your Web Server Configuration:   https://y

njs-0.8.7

2024-10-22 Thread Dmitry Volyntsev
Hello, I'm glad to announce a new release of NGINX JavaScript module (njs). This release fixes excessive memory consumption introduced in 0.8.6. Learn more about njs: - Overview and introduction:   https://nginx.org/en/docs/njs/ - NGINX JavaScript in Your Web Server Configuration:   ht

njs-0.8.6

2024-10-02 Thread Dmitry Volyntsev
Hello, I'm glad to announce a new release of NGINX JavaScript module (njs). This release introduced the QuickJS engine support in nginx modules. Read more here: https://nginx.org/en/docs/njs/engine.html Notable new features: - QuickJS in nginx: : nginx.conf: : location /engine { : js_engine

njs-0.8.5

2024-06-25 Thread Dmitry Volyntsev
Hello, I'm glad to announce a new release of NGINX JavaScript module (njs). Learn more about njs: - Overview and introduction:   https://nginx.org/en/docs/njs/ - NGINX JavaScript in Your Web Server Configuration:   https://youtu.be/Jc_L6UffFOs - Extending NGINX with Custom Code:   h

NGINX JavaScript (njs) has migrated to Github

2024-06-05 Thread Dmitry Volyntsev
Hello, This week we took the next step in our commitment to the Open Source community by moving the official njs code repository to GitHub (https://github.com/nginx/njs). As part of the move, we have revamped our testing infrastructure and added clearer guidelines around installation, building,

njs-0.8.4

2024-04-16 Thread Dmitry Volyntsev
Hello, I'm glad to announce a new release of NGINX JavaScript module (njs). This release introduced the initial QuickJS engine support in CLI as well as regular bugfixes. Notable new features: - QuickJS in njs CLI: : $ ./configure --cc-opt="-I/path/to/quickjs -L/path/to/quickjs" && make njs : $

njs-0.8.3

2024-02-07 Thread Dmitry Volyntsev
Hello, I'm glad to announce a new release of NGINX JavaScript module (njs). This release focuses on stabilization of recently released features and fixing bugs found by various fuzzers. Learn more about njs: - Overview and introduction:   https://nginx.org/en/docs/njs/ - NGINX JavaScript i

njs-0.8.2

2023-10-24 Thread Dmitry Volyntsev
Hello, I'm glad to announce a new release of NGINX JavaScript module (njs). Notable new features: - console object in nginx modules: Console object is a global object that provides access to the environment's console. It can be used to log information to the console, using console.log(), console.

Re: Debugging Nginx Memory Spikes on Production Servers

2023-09-26 Thread Dmitry Volyntsev
On 9/26/23 8:30 AM, Lance Dockins wrote: Up until now, I had assumed that string.match types of statements were just transparently calling PCRE behind the scenes so that the associated memory from the PCRE call was being freed after use.  Maybe that’s not even an accurate read on how Nginx is

Re: Debugging Nginx Memory Spikes on Production Servers

2023-09-21 Thread Dmitry Volyntsev
any form of file I/O at all (since the memory problems seem to be persistent whether doing reads or even log writes). — Lance Dockins On Thursday, Sep 21, 2023 at 5:01 PM, Dmitry Volyntsev wrote: On 9/21/23 6:50 AM, Lance Dockins wrote: Hi Lance, See my comments below

Re: Debugging Nginx Memory Spikes on Production Servers

2023-09-21 Thread Dmitry Volyntsev
parsing a larger file woudl be if multiple js_sets and such would just keep spawning VMs and accumulating memory during a single request. Any thoughts? — Lance Dockins On Thursday, Sep 21, 2023 at 1:45 AM, Dmitry Volyntsev wrote: On 20.09.2023 20:37, Lance Dockins wrote: So

Re: Debugging Nginx Memory Spikes on Production Servers

2023-09-20 Thread Dmitry Volyntsev
On 20.09.2023 20:37, Lance Dockins wrote: So I guess my question at the moment is whether endless memory use growth being reported by njs.memoryStats.size after file writes is some sort of false positive tied to quirks in how memory use is being reported or whether this is indicative of a memo

Re: Help

2023-09-17 Thread Dmitry Volyntsev
et  and the version you used before? On 9/17/23 12:28, Dmitry Volyntsev wrote: On 17.09.2023 06:39, Revvy via nginx wrote: Sep 17 13:36:52 toronto-srv-03 nginx[127394]: nginx: [emerg] dlopen() "/etc/nginx/modules/ngx_http_js_module.so" failed (/etc/nginx/modules/ngx_http_

Re: Help

2023-09-17 Thread Dmitry Volyntsev
On 17.09.2023 06:39, Revvy via nginx wrote: Sep 17 13:36:52 toronto-srv-03 nginx[127394]: nginx: [emerg] dlopen() "/etc/nginx/modules/ngx_http_js_module.so" failed (/etc/nginx/modules/ngx_http_js_module.so: undefined symbol: EVP_PKEY_CTX_set1_hkdf_salt) in /etc/nginx/nginx.conf:4 Hi Revvy

Re: njs-0.8.1

2023-09-12 Thread Dmitry Volyntsev
is a typo. Am 13.09.2023 um 01:10 schrieb Dmitry Volyntsev : Hello, I'm glad to announce a new release of NGINX JavaScript module (njs). Notable new features: - Periodic code execution: js_periodic direcrive specifies a content handler to run at regular interval. The handler recei

njs-0.8.1

2023-09-12 Thread Dmitry Volyntsev
Hello, I'm glad to announce a new release of NGINX JavaScript module (njs). Notable new features: - Periodic code execution: js_periodic direcrive specifies a content handler to run at regular interval. The handler receives a session object as its first argument, it also has access to global

njs-0.8.0

2023-07-06 Thread Dmitry Volyntsev
Hello, I'm glad to announce a new release of NGINX JavaScript module (njs). Notable new features: - shared dictionaries: Shared dictionary keeps the key-value pairs shared between worker processes. This allows to cache data in memory and share it between workers. : example.conf: : # Creates a

njs-0.7.12

2023-04-10 Thread Dmitry Volyntsev
Hello, I'm glad to announce a new release of NGINX JavaScript module (njs). Notable new features: - "zlib" module: : const zlib = require('zlib'); : zlib.deflateRawSync('αβγ').toString('base64') : /* "O7fx3KZzmwE=" */ : : zlib.inflateRawSync(Buffer.from('O7fx3KZzmwE=', 'base64')).toString() : /*

njs-0.7.11

2023-03-09 Thread Dmitry Volyntsev
Hello, I'm glad to announce a new release of NGINX JavaScript module (njs). Notable new features: - XMLNode API to modify XML documents: : const xml = require("xml"); : let data = `ToveJani`; : let doc = xml.parse(data); : : doc.$root.to.$attr$b = 'bar2'; : doc.$root.to.setAttribute('c', 'baz');

Re: NJS Body File Access Race Condition?

2023-02-10 Thread Dmitry Volyntsev
ion is to increase the client_body_buffer_size ensuring the the body is always in memory. -- Lance Dockins On Feb 10, 2023 at 8:49 PM -0600, Dmitry Volyntsev , wrote: Hi Lance, On 10.02.2023 18:24, Lance Dockins wrote: This sort of NJS behavior "seems" like some sort of race condition where NJS is

Re: NJS Body File Access Race Condition?

2023-02-10 Thread Dmitry Volyntsev
Hi Lance, On 10.02.2023 18:24, Lance Dockins wrote: This sort of NJS behavior "seems" like some sort of race condition where NJS is trying to access the file after Nginx has already disposed of it.  Since this is a js_content directive, it should be blocking and it seems to be one of the few s

njs-0.7.10

2023-02-07 Thread Dmitry Volyntsev
Hello, I'm glad to announce a new feature heavy release of NGINX JavaScript module (njs). Notable new features: - Fetch API extended support, including Headers() and Request() constructors: : async function makeRequest(uri, headers) { : let h = new Headers(headers); : h.delete("bar")

njs-0.7.9

2022-11-17 Thread Dmitry Volyntsev
Hello, This is a bugfix release that fixes Fetch Response prototype reinitialization. When at least one js_import directive was declared in both HTTP and Stream, ngx.fetch() returned inapproriate response in Stream. The bug was introduced in 0.7.7. Learn more about njs: - Overview and introdu

njs-0.7.8

2022-10-25 Thread Dmitry Volyntsev
Hello, I'm glad to announce a new release of NGINX JavaScript module (njs). Notable new features: - js_preload_object directive: The directive preloads an immutable object at configure time. This significantly reduces the runtime cost of referencing large objects in JS code. Learn

njs-0.7.7

2022-08-30 Thread Dmitry Volyntsev
Hello, I'm glad to announce a new release of NGINX JavaScript module (njs). Notable new features: - advances fs API: New API allows to open a file and read from and write to at specified location without reading the whole file. import fs from 'fs'; async function modifying_lar

njs-0.7.6

2022-07-19 Thread Dmitry Volyntsev
Hello, I'm glad to announce a new release of NGINX JavaScript module (njs). Notable new features: - improved r.args: Now, duplicate keys are returned as an array, keys are case-sensitive, both keys and values are percent-decoded. For example, the query string 'a=1&b=%32&A=3&b=

njs-0.7.5

2022-06-21 Thread Dmitry Volyntsev
Hello, I'm glad to announce a new release of NGINX JavaScript module (njs). This release focuses on stabilization of recently released features and fixing bugs found by various fuzzers. Learn more about njs: - Overview and introduction: https://nginx.org/en/docs/njs/ - NGINX JavaScript in Your

njs-0.7.4 (fixed formatting)

2022-05-24 Thread Dmitry Volyntsev
Hello, I’m glad to announce a new release of NGINX JavaScript module (njs). This release focuses on stabilization of recently released features including WebCrypto API and fixing bugs found by various fuzzers. Learn more about njs: - Overview and introduction: https://nginx.org/en/docs/njs/ -

njs-0.7.4

2022-05-24 Thread Dmitry Volyntsev
Hello, I'm glad to announce a new release of NGINX JavaScript module (njs). This release focuses on stabilization of recently released features including WebCrypto API and fixing bugs found by various fuzzers. Learn more about njs: - Overview and introduction:https://nginx.org/en/docs/njs/ - N

njs-0.7.3

2022-04-12 Thread Dmitry Volyntsev
Hello, I'm glad to announce a new release of NGINX JavaScript module (njs). This release focuses on stabilization of recently released features including async/await and fixing bugs found by various fuzzers. Learn more about njs: - Overview and introduction:https://nginx.org/en/docs/njs/ - NGI

Re: Njs - r.variables does not contain variables declared by js_var

2022-04-06 Thread Dmitry Volyntsev
Hi, See the following reply on Github https://github.com/nginx/njs/issues/460#issuecomment-1015642606 On 06.04.2022 00:02, 王明君 wrote: Hi, sorry to bother again ~ I was trying to access variables declared using js_var but failed. Confused why is that. This is a test demo, but actually i have

Re: Njs Utility not working

2022-04-05 Thread Dmitry Volyntsev
aas.mail.163.com/dashi-web-extend/html/proSignature.html?ftlId=1&name=%E7%8E%8B%E6%98%8E%E5%90%9B&uid=wmjhappy_ok%40126.com&iconUrl=https%3A%2F%2Fmail-online.nosdn.127.net%2Fsm169ab9356098976ee9a1ecee61e677f0.jpg&items=%5B%22wmjhappy_ok%40126.com%22%5D> On 4/6/2022 09:51,Dmitry Volyntse

Re: Njs Utility not working

2022-04-05 Thread Dmitry Volyntsev
Hi, Please attach the configure output. If njs CLI was built successfully, but the binary does not work in terminal mode. The reason is libreadline was not found during configure phase. On 05.04.2022 16:15, 王明君 wrote: Hi, i'm trying to build only njs command-line utility following _http://n

njs-0.7.2

2022-01-25 Thread Dmitry Volyntsev
Hello, I'm glad to announce a new release of NGINX JavaScript module (njs). This release focuses on stabilization of recently released features including async/await and fixing bugs found by various fuzzers. Learn more about njs: - Overview and introduction: https://nginx.org/en/docs/njs/ - NG

njs-0.7.1

2021-12-28 Thread Dmitry Volyntsev
Hello, I'm glad to announce a new release of NGINX JavaScript module (njs). This release focuses on stabilization of recently released features including async/await and HTTPS support in ngx.fetch(). The "js_include" directive deprecated since 0.4.0 was removed. Also a series of user invisible

njs-0.7.0

2021-10-19 Thread Dmitry Volyntsev
Hello, I'm glad to announce a new release of NGINX JavaScript module (njs). This release adds a bunch of long-awaited features. Notable new features: - async/await support: - HTTPS support in Fetch API: : async function content(r) { : let results = await Promise.all([ngx.fetch('https://ngin

njs-0.6.2

2021-08-31 Thread Dmitry Volyntsev
Hello, I'm glad to announce a new release of NGINX JavaScript module (njs). This release proceeds to extend the coverage of ECMAScript specifications. Notable new features: - Advanced Promise constructor methods : Promise.all(urls.map(u => ngx.fetch(u))) : .then(responses => r.return(200, JSON.

Re: NJS Questions and/or Bugs

2021-08-11 Thread Dmitry Volyntsev
Hi Lance, Thanks for your detailed feedback. >What exactly should r.variables and r.rawVariables contain?  ... r.variables and r.rawVariables are special objects, because they are created on the fly. There is no way to get all the possible variable names from nginx. So Object.keys(r.variables

njs-0.6.1

2021-06-29 Thread Dmitry Volyntsev
Hello, This is a bugfix release that fixes RegExp matching for a regular expression containing UTF-8 characters. The matching of ASCII or byte string by UTF-8 regexp was always negative. What methods were affected: - RegExp.prototype.exec() (since 0.4.2) - RegExp.protytype.test() (since 0.5.3)

njs-0.6.0

2021-06-15 Thread Dmitry Volyntsev
Hello, I'm glad to announce a new release of NGINX JavaScript module (njs). This release proceeds to extend the coverage of ECMAScript specifications. Notable new features: - let and const declarations support : >> fuction test() { x = 1; let x; } : undefined : >> test() : ReferenceError: canno

njs-0.5.3

2021-03-30 Thread Dmitry Volyntsev
Hello, I'm glad to announce a new release of NGINX JavaScript module (njs). This release focuses on extending the modules functionality. Notable new features: - js_var directive. The directive creates an nginx variable writable from njs. The variable is not overwritten after a redirect unli

njs-0.5.2

2021-03-09 Thread Dmitry Volyntsev
Hello, I'm glad to announce a new release of NGINX JavaScript module (njs). This release focuses on extending the modules functionality. Notable new features: - js_body_filter directive. The directive allows changing the response body. : nginx.conf: : js_import foo.js; : : location / {

njs-0.5.1

2021-02-16 Thread Dmitry Volyntsev
Hello, I'm glad to announce a new release of NGINX JavaScript module (njs). This release focuses on extending the modules functionality. Notable new features: - ngx.fetch() method implements a generic HTTP client which does not depend on subrequests: : example.js: : function fetch(r) { :

Re: Response headers adding/filtering during proxy with njs

2021-01-19 Thread Dmitry Volyntsev
On 19.01.2021 18:44, Grzegorz Kulewski wrote: Hello, Is it possible to (at least) add (or better also) filter response headers (like for example setting or modifying or deleting cookies, of course without harming other cookies set by the upstream) dynamically from njs after it is returned fr

njs-0.5.0

2020-12-02 Thread Dmitry Volyntsev
Hello, I'm glad to announce a new release of NGINX JavaScript module (njs). This release focuses mostly on adding Buffer support in nginx modules. Buffer is a better alternative to string when working with arbitrary data and especially with binary protocols, because JavaScript strings operate o

njs-0.4.4

2020-09-29 Thread Dmitry Volyntsev
Hello, I'm glad to announce a new release of NGINX JavaScript module (njs). This release proceeds to extend the coverage of ECMAScript specifications. Notable new features: - Buffer object. : >> var buf = Buffer.from([0x80,206,177,206,178]) : undefined : >> buf.slice(1).toString() : 'αβ' : >> b

njs-0.4.3

2020-08-11 Thread Dmitry Volyntsev
Hello, I'm glad to announce a new release of NGINX JavaScript module (njs). This release proceeds to extend the coverage of ECMAScript specifications. Notable new features: - querystring module. : var qs = require('querystring'); : : function fix_args(args) { : args = qs.parse(args); : :   

Re: Is there any plan to support WebAssembly?

2020-07-22 Thread Dmitry Volyntsev
On 20.07.2020 06:21, 肖涵 wrote: Hi WebAssembly provides a new way to extend the module, like envoy already supports WebAssembly. we would like to consult nginx's attitude towards this In addition, We have supported  WebAssembly for Nignx. we can load the

njs-0.4.2

2020-07-07 Thread Dmitry Volyntsev
Hello, I'm glad to announce a new release of NGINX JavaScript module (njs). This release proceeds to extend the coverage of ECMAScript specification. You can learn more about njs: - Overview and introduction: http://nginx.org/en/docs/njs/ - Presentation: https://youtu.be/Jc_L6UffFOs - Using no

njs-0.4.1

2020-05-19 Thread Dmitry Volyntsev
Hello, I'm glad to announce a new release of NGINX JavaScript module (njs). This release extends http module. Notable new features: - raw headers API: With the following request headers: : Host: localhost : Foo: bar : foo: bar2 All 'foo' headers can be collected with the syntax: : r.rawHeadersIn

njs-0.4.0

2020-04-23 Thread Dmitry Volyntsev
Hello, I’m glad to announce a new release of NGINX JavaScript module (njs). This release focuses on extending http and stream modules. Notable new features: - js_import directive. : nginx.conf: : js_import foo.js; : js_import lib from path/file.js; : : location / { : js_content foo.

njs-0.3.9

2020-03-03 Thread Dmitry Volyntsev
Hello, I'm glad to announce a new release of NGINX JavaScript module (njs). This release proceeds to extend the coverage of ECMAScript specifications. Notable new features: - Promises API for "fs" module. : var fs = require('fs').promises; : fs.readFile('/file/path').then(data => r.return(200,

njs-0.3.8

2020-01-21 Thread Dmitry Volyntsev
Hello, I'm glad to announce a new release of NGINX JavaScript module (njs). This release proceeds to extend the coverage of ECMAScript specifications. This release adds Promise object support and typed-arrays from ES6. Notable new features: - Promise support in r.subrequest(): : r.subrequest(

njs-0.3.7

2019-11-19 Thread Dmitry Volyntsev
Hello, I'm glad to announce a new release of NGINX JavaScript module (njs). This release proceeds to extend the coverage of ECMAScript specifications. Notable new features: - Object.assign() method: : > var obj = { a: 1, b: 2 } : undefined : > var copy = Object.assign({}, obj) : undefined : >

njs-0.3.6

2019-10-22 Thread Dmitry Volyntsev
Hello, I'm glad to announce a new release of NGINX JavaScript module (njs). This release proceeds to extend the coverage of ECMAScript specifications. Notable new features: - Function constructor: : > var sum = new Function('a, b', 'return a + b'); : undefined : > sum(2, 3) : 5 You can learn

njs-0.3.5

2019-08-15 Thread Dmitry Volyntsev
This is a bugfix release that eliminates heap-use-after-free introduced in 0.3.4. What installations are affected: - Importing built-in modules (crypto, fs) using require(). You can learn more about njs: - Overview and introduction: http://nginx.org/en/docs/njs/

njs-0.3.4

2019-08-13 Thread Dmitry Volyntsev
Hello, I'm glad to announce a new release of NGINX JavaScript module (njs). This release proceeds to extend the coverage of ECMAScript specifications. Apart from specs conformance fuzzing under Memory-Sanitizer is introduced which allowed to catch new types of bugs. Notable new features: - Sho

njs-0.3.3

2019-06-25 Thread Dmitry Volyntsev
Hello, I’m glad to announce a new release of NGINX JavaScript module (njs). This release mostly focuses on stability issues in njs core after regular fuzzing tests were introduced. Notable new features: - Added ES5 property getter/setter runtime support: : > var o = {a:2}; : undefined : > Object

Re: njs: how to define a global variable

2019-06-03 Thread Dmitry Volyntsev
On 29.05.2019 20:02, guy1976 wrote: hi is it possible to define a global variable that will be persist for different requests? Hi Guy, Currently it is not possible as all njs VM are short-lived (a VM per request). If performance is not a serious issue you can use FS API (see http://ngi

njs-0.3.2

2019-05-21 Thread Dmitry Volyntsev
Hello, I'm glad to announce a new release of NGINX JavaScript module (njs). This release mostly focuses on stability issues in njs core after regular fuzzing tests were introduced. Notable new features: - Added ES6 template literals support: : > var a = "Template", b = "literals" : undefined :

njs-0.3.1

2019-04-16 Thread Dmitry Volyntsev
Hello, I'm glad to announce a new release of NGINX JavaScript module (njs). This release proceeds to extend the coverage of ECMAScript specifications and modules functionality. - Added ES6 arrow functions support: : > var materials = ['Hydrogen', 'Helium', 'Lithium'] : undefined : > materials.m

njs-0.3.0

2019-03-26 Thread Dmitry Volyntsev
Hello, I'm glad to announce a new release of NGINX JavaScript module (njs). This release proceeds to extend the coverage of ECMAScript specifications and modules functionality. - Added initial ES6 modules support: : // module.js : function sum(a, b) {return a + b} : export default {sum}; : // s

Re: njs question

2019-02-26 Thread Dmitry Volyntsev
On 26.02.2019 9:24, ?? wrote: hello! Hello! I would like to ask some questions about the development of NJS. Hi ?? First: when will NJS improve the ES6 standard? According to http://nginx.org/en/docs/njs/index.html we plan to extend coverage of ES6 and later specifications. This i

njs-0.2.8

2019-02-26 Thread Dmitry Volyntsev
Hello, I'm glad to announce a new release of NGINX JavaScript module (njs). This release proceeds to extend the coverage of ECMAScript specifications and modules functionality. - Added support for setting nginx variables. - Added support for delete operation in r.headersOut. - Properties of

njs-0.2.7

2018-12-25 Thread Dmitry Volyntsev
Hello, I'm glad to announce a new release of NGINX JavaScript module (njs). This release proceeds to extend the coverage of ECMAScript specifications. - Added support for ES6 rest parameters syntax. Thanks to Alexander Pyshchev. : > var add = function(prev, curr) { return prev + curr } :

Re: Nginscript

2018-11-28 Thread Dmitry Volyntsev
On 28.11.2018 3:21, chadhasumit13 wrote: Hi, I intend to generate a unique id (by making use of npm uuid ) and make an external call to an HTTP end-point, whenever a new call is received by NGINX. Is it possible to use nginscript for this purpose? If yes, could you please route me to a good

njs-0.2.6

2018-11-27 Thread Dmitry Volyntsev
Hello, I'm glad to announce a new release of NGINX JavaScript module (njs). This release proceeds to extend the coverage of ECMAScript 5.1 specification. - Added initial support for extending the existing prototypes. So, generic functions can be added to extend functionality of built-in ty

Re: njs and subrequests

2018-11-19 Thread Dmitry Volyntsev
Hi Antoine, >Is there any plan to have subrequest from ngx_http_js_module support > external URLs ? Nothing prevents you from making subrequests to external URLs. https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_pass https://nginx.org/en/docs/http/ngx_http_core_module.html#reso

Re: Variable scope in javascript module

2018-10-30 Thread Dmitry Volyntsev
On 30.10.2018 19:58, alweiss wrote: Here is a sample that works with Java but not with njs : function my() { resp = "Start"; console.log ('Initial resp is ' + resp); function done() { resp += "AndContinue"; console.log('In loop resp is ' + resp) }

njs 0.2.5 release

2018-10-30 Thread Dmitry Volyntsev
Hello, I'm glad to announce a new release of NGINX JavaScript module (njs). This release proceeds to extend the coverage of ECMAScript 5.1 specification. - arguments object is added. So, it is possible to write functions which can take the arbitrary number of arguments as well as wrapp

Re: large request body in njs

2018-10-30 Thread Dmitry Volyntsev
> On 29 Oct 2018, at 23:44, Jonathan Esterhazy > wrote: > > Hello! > > I am trying to use njs (ngx_http_js_module) to modify POSTed request data > before sending to an upstream api. Using the req.requestBody function works > fine for small requests, but for larger ones causes this error: >

Re: Variable scope in javascript module

2018-10-26 Thread Dmitry Volyntsev
Hi Alex, Can you, please, share your code? You can also try to play with njs code in the command line interface. For example: njs interactive njs 0.2.3 v. -> the properties and prototype methods of v. type console.help() for more information >>function my(){var g = 'init'; console.log(g); (

Re: Nginx NJS fs.writeFileSync is atomic writing and race condition prevention ?

2018-10-19 Thread Dmitry Volyntsev
On 19.10.2018 06:33, HENG wrote: Hello: I am new to Nginx NJS, and I want to write a website with NJS. I want to write a simple JSON database with NJS fs.writeFileSync ,just like Node.js LowDB. but I have no idea . Does NJS fs.writeFileSync is atomic writing and race condition prevention

Re: How to install njs after building from sources

2018-08-08 Thread Dmitry Volyntsev
On 08.08.2018 17:06, Mustafa Aldemir wrote: Hello, I built NGINX and njs from sources. Now I have njs executable and some static object files under ~/njs/build. How should I install njs or configure NGINX to run with njs? Hi Mustafa, Please, use the instruction from here http://nginx.or

Re: sub_filter not working on JSON file

2018-08-02 Thread Dmitry Volyntsev
On 02.08.2018 16:46, Friscia, Michael wrote: I’m trying to figure out why my sub_filter is not working on a JSON file. I do have application/json and text/json listed in the sub_filter_types but the simple string replace is not happening. It causes me to think that for whatever reason, Nginx

Re: redirect based on file content

2018-07-16 Thread Dmitry Volyntsev
You can try to use njs here: http://nginx.org/en/docs/http/ngx_http_js_module.html http://nginx.org/en/docs/njs/njs_api.html#http - more about r object. nginx.conf: http { js_include http.njs; ... server { listen 9000; location / {

Re: nginScript question

2018-04-18 Thread Dmitry Volyntsev
On 17.04.2018 21:30, djcza...@gmail.com wrote: Is there a roadmap for nginScript There is. The short term preliminary plan is: - stream integration refactoring to match the way it done in http - access to shared memory storage - base64 encode __

Re: unknown directive "js_include"

2018-04-12 Thread Dmitry Volyntsev
On 12.04.2018 17:28, Dineshkumar wrote: Hi Dmitry, The module has been loaded in the nginx.conf file using the following load_module modules/ngx_http_js_module.so; and the compile module files are available in the path as well. Please note that RHEL5 packets are outdated (js_include was not

Re: unknown directive "js_include"

2018-04-12 Thread Dmitry Volyntsev
On 12.04.2018 17:17, Dineshkumar wrote: Hi All, Im getting the following error when using nginscript module in RHEL 5 server. nginx: [emerg] unknown directive "js_include" in /etc/nginx/nginx.conf:13 Installed the nginx using the following RPM https://nginx.org/packages/rhel/5/x86_64/RPMS/ngi

Re: nginScript question

2018-04-10 Thread Dmitry Volyntsev
On 13.07.2017 18:14, aledbf wrote: Thanks! Hi, I am glad to inform you that since njs-0.2.0 it is possible to create arbitrary http subrequests from js_content phase. Here you can find the subrequest API description: http://hg.nginx.org/njs/rev/750f7c6f071c Here you can find some usage

Re: Where can I find nginScript shell

2018-01-09 Thread Dmitry Volyntsev
On 07.01.2018 17:06, kimown wrote: I find the associated code, thanks for your help, but I'm not familiar with how to building the nginScript shell, I think it's better add instruction in README.Also, nginScript is really really awesome. It is available as a part of nginx official packages.

Re: nginScript question

2017-07-13 Thread Dmitry Volyntsev
On 12.07.2017 23:57, aledbf wrote: Hi, It is possible to make a HTTP request with nginScript? Hi, Unfortunately, this is not possible so far. But, we are going to add such functionality in the future. You can find what is currently possible here http://nginx.org/en/docs/http/ngx_http_js_

Re: nginx-1.11.0

2016-05-25 Thread Dmitry Volyntsev
On 25.05.2016 12:01, Alexey Genus wrote: > *) Feature: the "map" directive supports combinations of multiple variables as resulting values. Does this mean this ticket can be resolved? https://trac.nginx.org/nginx/ticket/663 Yes, it is resolved. ___