If one application has several backends, between which traffic is distributed by a balancer, then similar server blocks are created for each backend. In each such block, the listen directive specifies its own TCP port for each open port on the backend. Below is an example for an application with two backends.
The section 7 diagram shows balancing without using WAF.
Scheme 7 – Balancing scheme without WAF
To implement WAF, a port is opened on each analyzer for each backend, and the balancing scheme takes the form according to the example in the table section 3.
Table 3 – Balancing scheme
Balancer |
WAF Analyzer |
Backend |
||
|---|---|---|---|---|
10.0.0.1 |
-> |
10.0.10.1:8081
10.0.10.1:8082
10.0.10.2:8081
10.0.10.2:8082
|
-> |
10.0.100.1:80
10.0.100.2:80
10.0.100.1:80
10.0.100.2:80
|
The final scheme with balancing is presented in the section 8 diagram.
Scheme 8 – Balancing scheme with WAF
Example of proxy settings on the first WAF analyzer:
server {
include static/server.conf;
listen 10.0.10.1:8081;
server_name example.com www.example.com; # WAF configuration.
set $BACKEND http://10.0.100.1;
location / {
include static/waf.conf;
}
}
server {
include static/server.conf;
listen 10.0.10.1:8082;
server_name example.com www.example.com; # WAF configuration.
set $BACKEND http://10.0.100.2;
location / {
include static/waf.conf;
}
}

