Summary of Methods and Properties of the HTTP Object in the Nginx JS Module

Summary of Methods and Properties of the HTTP Object in the Nginx JS Module

1. Summary of Methods and Properties of the HTTP Object in the JS Module <span>r.args</span> Request parameters, case-sensitive, read-only. Values of repeated parameter names are converted to an array. For example, <span>'a=1&b=2&A=3&b=4&B=two%20words'</span> is converted to <span>r.args</span>, resulting in <span>{a: "1", b: ["2", "4"], A: "3", B: "two words"}</span>. <span>r.done()</span> After calling this function, the next … Read more

Modifying HTTP Response Content with Nginx JS Module

Modifying HTTP Response Content with Nginx JS Module

1. Directive Introduction js_body_filter directive: Sets a JS function as a filter for the HTTP response body, calling the specified function for each data chunk of the response body. This directive allows dynamic modification of the response body content. The filter function has 3 parameters: r: HTTP object data: Current data chunk flags: An object … Read more