haProxy: как сохранить IP-адрес haproxy в URL - PullRequest
0 голосов
/ 08 октября 2018

У меня настроен haproxy -X с двумя бэкэнд-серверами Y и Z

Моя проблема в том, что когда я вызываю X (haproxy), он правильно перенаправляет на Y или Z, но URL-адрес также изменяется (Содержит Y или Z IP), Так что теперь я говорю непосредственно с WebServer вместо haProxy Server.

есть ли способ сохранить haProxy IP в запросах?

haproxy.cfg

    global
    log 127.0.0.1 local0
    maxconn 2000
  user haproxy
  group haproxy

defaults
    log global
    mode    http
    option  httplog
    option  dontlognull
        contimeout 5000
        clitimeout 50000
        srvtimeout 50000
    errorfile 400 /etc/haproxy/errors/400.http
    errorfile 403 /etc/haproxy/errors/403.http
    errorfile 408 /etc/haproxy/errors/408.http
    errorfile 500 /etc/haproxy/errors/500.http
    errorfile 502 /etc/haproxy/errors/502.http
    errorfile 503 /etc/haproxy/errors/503.http
    errorfile 504 /etc/haproxy/errors/504.http

frontend LB
   bind *:80
   reqadd X-Forwarded-Proto:\ http
   option   httplog
   default_backend LB

backend LB
   mode http
   stats enable
   stats hide-version
   stats uri /stats
   stats realm Haproxy\ Statistics
   stats auth haproxy:redhat        # Credentials for HAProxy Statistic report page.
   balance roundrobin           # Load balancing will work in round-robin process.
   option httpchk
   option  httpclose
   option forwardfor
   option   httplog
   cookie LB insert
   server web1-srv 10.164.29.225:80 cookie web1-srv check       # backend server.
   server web2-srv 10.164.27.31:80 cookie web2-srv check        # backend server.
...