Configuring Correct User IP Display When Using HAProxy Authentication
When using a load balancer such as HAProxy, all users in the system see the HAProxy address instead of the actual IP address of the user's workstation.
Solution:
-
Add the following line to the HAProxy configuration file in the
backend jms-websection:
backend jms-web
mode http
option forwardfor except 127.0.0.1
http-request set-header X-Forwarded-For %[src]
-
On each JS server, open the Nginx configuration file:
nano /opt/jumpserver/config/nginx/lb_http_server.conf
server {
listen 443 ssl http2;
set_real_ip_from 10.10.53.210; # IP вашего HAProxy
real_ip_header X-Forwarded-For;
real_ip_recursive on;
server_tokens off;
-
Restart HAProxy and Jumpserver.
systemctl restart haproxy
jmsctl restart