服务器 
首页 > 服务器 > 浏览文章

让iis记录nginx反向代理的真实ip

(编辑:jimmy 日期: 2024/11/14 浏览:3 次 )

一、设置X-Forwarded-For段

nginx配置示例:

复制代码 代码如下:server
{
   location
   {
     ...
     proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
     ...
   }

二、在iis站点上安装isapi filter

在f5的开发论坛上找到的,按开发者的话说,是为了解决iis放在f5后记录不到用户ip的问题,管他前端是f5还是nginx还是squid还是haproxy,都可以用。
装完之后重启下iis即可。

https://devcentral.f5.com/weblogs/Joe/archive/2009/08/19/x_forwarded_for_log_filter_for_windows_servers.aspx

安装方法,从官方文档复制了过来的,大家看看咯。
Installation

Follow these steps to install the filter.

Download and unzip the F5XForwardedFor.zip distribution.
Copy the F5XForwardedFor.dll file from the x86\Release or x64\Release directory (depending on your platform) into a target directory on your system. Let's say C:\ISAPIFilters.
Ensure that the containing directory and the F5XForwardedFor.dll file have read permissions by the IIS process. It's easiest to just give full read access to everyone.
Open the IIS Admin utility and navigate to the web server you would like to apply it to.
For IIS6, Right click on your web server and select Properties. Then select the "ISAPI Filters" tab. From there click the "Add" button and enter "F5XForwardedFor" for the Name and the path to the file "c:\ISAPIFilters\F5XForwardedFor.dll" to the Executable field and click OK enough times to exit the property dialogs. At this point the filter should be working for you. You can go back into the property dialog to determine whether the filter is active or an error occurred.
For II7, you'll want to select your website and then double click on the "ISAPI Filters" icon that shows up in the Features View. In the Actions Pane on the right select the "Add" link and enter "F5XForwardedFor" for the name and "C:\ISAPIFilters\F5XForwardedFor.dll" for the Executable. Click OK and you are set to go.
I'd love to hear feedback on this and if there are any other feature request, I'm wide open to suggestions. The source code is included in the download distribution so if you make any changes yourself, let me know!

Good luck and happy filtering!

上一篇:linux(centos5.5)/windows下nginx开启phpinfo模式功能的配置方法分享
下一篇:为高负载网络优化Nginx和Node.js的方法
一句话新闻
高通与谷歌联手!首款骁龙PC优化Chrome浏览器发布
高通和谷歌日前宣布,推出首次面向搭载骁龙的Windows PC的优化版Chrome浏览器。
在对骁龙X Elite参考设计的初步测试中,全新的Chrome浏览器在Speedometer 2.1基准测试中实现了显著的性能提升。
预计在2024年年中之前,搭载骁龙X Elite计算平台的PC将面世。该浏览器的提前问世,有助于骁龙PC问世就获得满血表现。
谷歌高级副总裁Hiroshi Lockheimer表示,此次与高通的合作将有助于确保Chrome用户在当前ARM兼容的PC上获得最佳的浏览体验。