In order to obtain the real IP in the application, it depends on the transfer configuration of each forwarding node.
First, determine which request header the client uses to transfer the IP address.
Second, the first forwarding point.
proxy_set_header field value
value is the variable value, which comes from the requester
field is the variable name, which is the variable to be sent to the next station
Pay attention to this order, set sets the variable to be sent to the next station, and then writes the value of the variable
server {
listen 80;
server_name a.b.com;
proxy_set_header X-Real-IP $remote_addr;
proxy_buffering off;
location / {
proxy_pass http://localhost:8989;
}
}