In nginx, how can you set up your proxy_pass so it sends to correct client remote ip address? Currently, only the server’s ip shows up. I know that the proper way to do this is
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
However, on the other end I have a support system that is not written by me. I don’t want to change all the code to fit the X-Forwarded-For parameter.
How can I tell nginx to send the $remote_addr in the format so that it can be read with $_SERVER['REMOTE_ADDR']?
proxy_set_header REMOTE_ADDR $remote_addr;don’t work in nginx proxy_pass (link)So you must prepare some middleware to your application.
For example, pseudo-code: