场景介绍:
用户端------------>F5------------------>应用系统(weblogic应用服务器)
应用系统的access日志中记录的信息全部是F5的地址而非用户端的实际IP地址,
1、经过查找F5的资料,发现F5中有这样一个配置项:X-Forwarded-For,指向的是F5地址,导致access日志记录的是F5地址。另外,检查http profile配置,将参数Insert X-Forwarded-For配置启用,F5会将用户的IP地址插入X-Forwarded-For 作为标头,才在weblogic的access日志中记录用户的实际IP地址。
2、登录weblogic控制台
第一步:
AdminConsole —> Servers —-> [Your_Server_Name] —> Configuration [Tab] —> General [Sub-Tab] —>
- Click on “Advanced” Link
- Check the CheckBox in this Page “WebLogic Plug-In Enabled”
“WL-Proxy-Client-IP”
第二步:
Servers –> [YOUR_SERVER_NAME] —> Logging [Tab] —> HTTP [sub-tab]
- Click on Advanced Link at the bottom of the page
- In the “Extended Logging Format Fields:” Just add the
c-ip at the beginning or at the end of the values and save it.
这里附上自定义日志字段的api:https://docs.oracle.com/cd/E13222_01/wls/docs81/adminguide/web_server.html#http_log
参考章节:Supported Field identifiers
第三步:
Servers -> [YOUR_SERVER_NAME] -> Protocols -> HTTP [sub-tab]
-In the 'Remote Address Override' text box enter 'X-Forwarded-For'
最后重启服务器!
转载请注明原创地址[http://write.blog.youkuaiyun.com/postedit/49851575],谢谢。

在Weblogic应用服务器的access日志中,由于F5的配置导致记录的IP为F5地址,而非用户的真实IP。解决方法包括在F5启用X-Forwarded-For插入用户IP,Weblogic端启用WebLogic Plug-In并设置'WL-Proxy-Client-IP',以及在HTTP配置中设置'Remote Address Override'为'X-Forwarded-For',通过这些步骤,可以在access日志中正确记录用户IP。
344

被折叠的 条评论
为什么被折叠?



