You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: USAGE-v4.2.md
+52-5Lines changed: 52 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -52,6 +52,57 @@ Locations `.declaration.http.servers[].locations[].uri` match modifiers in `.dec
52
52
-*iregex* - case insensitive regex matching
53
53
-*best* - case sensitive regex matching that halts any other location matching once a match is made
54
54
55
+
### Javascript profiles ###
56
+
57
+
NGINX Javascript profiles are defined in `.declaration.http.njs[]`:
58
+
59
+
-`name` - the NJS profile name
60
+
-`file.content` - the base64-encoded njs source code or the `http(s)://` URL of the file
61
+
-`file.authentication.server[0].profile` - authentication profile name if `file.content` is a URL and the request must be authenticated
62
+
63
+
### Javascript hooks ###
64
+
65
+
NGINX Javascript hooks can be used in:
66
+
67
+
-`.declaration.http.njs`
68
+
- Supported hooks:
69
+
- `js_preload_object'
70
+
- 'js_set`
71
+
-`.declaration.http.server[].njs`
72
+
- Supported hooks:
73
+
- `js_preload_object'
74
+
- 'js_set`
75
+
-`.declaration.http.server[].location[].njs`
76
+
- Supported hooks:
77
+
- `js_body_filter'
78
+
- 'js_content'
79
+
- 'js_header_filter'
80
+
- 'js_periodic'
81
+
- 'js_preload_object'
82
+
- 'js_set`
83
+
84
+
Hooks invocation is:
85
+
86
+
```
87
+
"njs": [
88
+
{
89
+
"hook": {
90
+
"name": "<HOOK_NAME>",
91
+
"parameters": [
92
+
{
93
+
"name": "<HOOK_PARAMETER_NAME>",
94
+
"value": "<HOOK_PARAMETER_VALUE>"
95
+
}
96
+
]
97
+
},
98
+
"profile": "<NGINX_JAVASCRIPT_PROFILE>",
99
+
"function": "<JAVASCRIPT_FUNCTION_NAME>"
100
+
}
101
+
]
102
+
```
103
+
104
+
For detailed examples see the [Postman collection](/contrib/postman)
105
+
55
106
### API Gateway ###
56
107
57
108
Swagger files and OpenAPI schemas can be used to automatically configure NGINX as an API Gateway. Developer portal creation is supported through [Redocly](https://redocly.com/)
0 commit comments