<!-- review: finished -->

<a id="external-eval"></a>

# Eval

The module allows saving subrequest response bodies in variables.

<a id="installation-10"></a>

## Installation

To [install](https://en.angie.software//angie/docs/installation/index.md#install-packages) the module, use one of the
following packages:

- Angie: `angie-module-eval`
- Angie PRO: `angie-pro-module-eval`

<a id="loading-the-module-10"></a>

## Loading the Module

Load the module in the `main{}` context:

```nginx
load_module modules/ngx_http_eval_module.so;
```

<a id="example-configuration-1"></a>

## Example Configuration

```nginx
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;
    }
}
```

<a id="additional-information-11"></a>

## Additional Information

Detailed documentation and source code are available at:
[https://github.com/openresty/nginx-eval-module](https://github.com/openresty/nginx-eval-module)
