Eval#
The module allows saving subrequest response bodies in variables.
Installation#
To install the module, use one of the following packages:
Angie:
angie-module-evalAngie PRO:
angie-pro-module-eval
Loading the Module#
Load the module in the main{} context:
load_module modules/ngx_http_eval_module.so;
Example Configuration#
server {
listen 80;
server_name localhost;
location / {
eval_subrequest_in_memory off;
eval_override_content_type text/plain;
eval_buffer_size 4k;
eval $res {
rewrite ^(/eval_.*/)(.*)$ /$2 break;
proxy_pass http://127.0.0.1:8081;
}
if ($res ~ "access denied") {
return 403 $res\n;
}
proxy_pass http://127.0.0.1:8082;
}
}
server {
listen 8081;
if ($arg_user != 'Legal') {
return 403 "access denied";
}
return 200 OK;
}
server {
listen 8082;
location / {
root /usr/share/angie/html;
}
}
Additional Information#
Version: 2016.06.10
Detailed documentation and source code are available at: openresty/nginx-eval-module