https://github.com/zigzagak/ngx_http_expr_module
Nginx lazy computed complex variables
https://github.com/zigzagak/ngx_http_expr_module
nginx nginx-lazy-variable nginx-variable
Last synced: about 2 months ago
JSON representation
Nginx lazy computed complex variables
- Host: GitHub
- URL: https://github.com/zigzagak/ngx_http_expr_module
- Owner: ZigzagAK
- License: bsd-3-clause
- Created: 2019-10-15T16:53:35.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2025-05-30T14:58:35.000Z (about 1 year ago)
- Last Synced: 2025-05-30T20:39:48.654Z (about 1 year ago)
- Topics: nginx, nginx-lazy-variable, nginx-variable
- Language: C
- Homepage:
- Size: 16.6 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.markdown
- License: LICENSE
Awesome Lists containing this project
README
Name
====
ngx_http_expr_module - lazy computed complex variables.
Table of Contents
=================
* [Name](#name)
* [Status](#status)
* [Synopsis](#synopsis)
* [Description](#description)
* [Configuration directives](#configuration-directives)
Status
======
This library is production ready.
Description
===========
Module makes possible declare complex variables with lazy computation. This is may be used to choose access_log format dynamically.
[Back to TOC](#table-of-contents)
Synopsis
========
```nginx
http {
log_format main $format;
access_log logs/access.log main;
expr_max_hash_size 10240;
server {
listen 4444;
location /test1 {
expr $format '1111 $remote_addr - $remote_user [$time_local] "$request" $status $request_time $upstream_addr';
return 200 test1;
}
location /test2 {
expr $format '2222 $remote_addr - $remote_user [$time_local] "$request" $status $request_time $upstream_addr';
return 200 test2;
}
location /test3 {
expr $format '3333 $remote_addr - $remote_user [$time_local] "$request" $status $request_time $upstream_addr';
echo_exec @inner1;
}
location @inner1 {
echo_exec @inner2;
}
location @inner2 {
return 200 $uri;
}
}
}
```
[Back to TOC](#table-of-contents)
Configuration directives
========================
expr_if_empty
-------------
* **syntax**: `expr_if_empty $var `
* **context**: `location`
Declare complex variable with lazy computation.
In runtime set value if variable is empty.
Directive is not support inheritance.
[Back to TOC](#table-of-contents)
expr
----
* **syntax**: `expr $var `
* **context**: `location`
Declare complex variable with lazy computation.
Directive is not support inheritance.
[Back to TOC](#table-of-contents)
expr_max_hash_size
------------------
* **syntax**: `expr $var `
* **default**: 1024
* **minimum**: 256
* **context**: `http,server,location`
Maximum number of locations per variable.
[Back to TOC](#table-of-contents)