linux-nginx 通过F5负载、获取F5转发前的用户客户端真实ip

背景

客户通过F5提供的虚拟ip访问应用,应用通过nginx访问应用资源和转发请求

需要获取到客户的客户端真实地址

nginx安装http_realip_module模块

编译nginx时安装http_realip_module模块
./configure --prefix=/usr/local/nginx --with-http_realip_module

增加配置

修改后的配置

复制代码
        location ^~ /ttt/ {
            set_real_ip_from <F5地址>;--增加
            real_ip_header X-Forwarded-For;--增加
            real_ip_recursive on;--增加
            proxy_pass http://ttt_server;
            proxy_set_header Host $http_host;
            proxy_set_header X-Forwarded-For $remote_addr;
            rewrite ^/ttt/(.*)$ /ttt/$1 break;
        }
相关推荐
七歌杜金房6 小时前
我终于又有了自己的 Linux 电脑
linux·debian·mac
tntxia1 天前
linux curl命令详解_curl详解
linux
扛枪的书生1 天前
Linux 网络管理器用法速查
linux
顺风尿一寸2 天前
Java Socket 内核之旅:从 SocketChannel.read() 到 tcp_recvmsg 与 epoll 的完整调用链路
linux
XIAOHEZIcode2 天前
Ubuntu 终端美化全栈指南:Bash 到 Kitty 踩坑实录
linux·ubuntu·命令行
唐青枫2 天前
别再只会用 cron:Linux systemd Timer 定时任务实战详解
linux
AlfredZhao4 天前
生产环境里,为什么不建议把普通端口直接暴露到公网?
linux·https·443·80
MrSYJ4 天前
TCP协议理解
后端·tcp/ip
戴为沐5 天前
Linux内存扩容指南
linux
zylyehuo5 天前
Linux 彻底且安全地删除文件
linux