前端 Load Balance 首選就是 HAProxy,後端架設 Nginx 搭配 CodeIgniter,紀錄使用者 IP 時,Nginx 總是只有抓到內部 IP 192.168.x.x,而無法抓到真實 Public IP,要抓到 Public IP 必須修改 HAProxy + Nginx 設定檔,HAProxy 只要在 Backend 地方加入 forward 選項,這樣 HAProxy 會送 X-Forwarded-For header 給後端 Nginx。
option forwardfor[Read More]