让iis记录nginx反向代理的真实ip
一、设置X-Forwarded-For段
nginx配置示例:
{
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!
相关文章
- 这篇文章主要介绍了Win10 IIS 安装及.net 4.5及Win10安装IIS并配置ASP.NET 4.0的方法,本文给大家介绍的非常详细,具有一定的参考借鉴价值,需要的朋友可以参考下...2021-09-22
- 这篇文章主要以图文结合的方式详细介绍了本地Windows 78上IIS服务器搭建教程,具有一定的参考价值,感兴趣的小伙伴们可以参考一下 ...2017-07-06
- 这篇文章主要介绍了Linux环境下nginx搭建简易图片服务器,需要的朋友可以参考下...2016-01-27
- 后台内容无法更新,如基本设置保存不了,数据库写不进去,很有可能是Everyone权限问题,即Everyone 无权操作文件夹,按照下面的步骤操作即可...2016-01-27
- 这篇文章主要介绍了IIS中保持HTTP连接的设置方法,需要的朋友可以参考下...2016-01-27
- 这篇文章主要介绍了Debian7编译安装nginx简明教程,本文直接给出操作命令和步骤,需要的朋友可以参考下...2016-01-27
- 这篇文章主要介绍了C#修改IIS站点framework版本号的方法,涉及C#调用使用ASP.NET IIS注册工具Aspnet_regiis.exe进行IIS站点framework版本号修改的方法,具有一定参考借鉴价值,需要的朋友可以参考下...2020-06-25
IIS中User-mode caching引起的Cache-Control不为public问题的解决方法
在IIS的Output caching中如果启用了User-mode caching将引起Cache-Control为no-cache,从而造成页面不能被浏览器或代理服务器缓存,下面看解决方法...2016-01-27- 一直以为windows下用nginx来配置反向代理,没想到微软官方也出了这个东西,特分享下, 方便需要的朋友...2016-01-27
- 下面我们以WIN2000服务器版本的来做例子,介绍一下怎样利用SSL加密HTTP通道来加强IIS安全的,需要的朋友可以参考下...2017-07-06
- 应一个朋友要求写了这个批处理程序,主要用途就是在win32系统中方便停止、开启、重启IIS、MySQL服务。 ...2016-01-27
IIS 环境下配置PHP5+MySql+PHPMyAdmin
虽然主要是做.net开发的,但是,时不时的还要搞一下php,但是,php在windows下的配置,总是走很多弯路,正好前几天又配置了一下,因此总结在这里,做为自己的备忘,也希望给遇到问题的朋友们提供一些帮助。...2016-01-27IIS下Zend 出现 Unable to view file mapping 问题的解决方法汇总
这篇文章主要介绍了IIS下Zend 出现 Unable to view file mapping 问题的解决方法汇总,需要的朋友可以参考下...2016-01-27- 相信大家都知道Nginx ("engine x") 是一个高性能的 HTTP和反向代理服务器,也是一个 IMAPPOP3SMTP 代理服务器。这篇文章将详细给大家介绍在CentOS7系统下用YUM安装Nginx的方法,有需要的朋友们可以参考借鉴,下面来一起看看吧。...2017-01-22
- 这篇文章主要给大家介绍了在CentOS系统下编译安装nginx及配置缩略图插件的方法教程,文中给出了详细的安装步骤,对大家具有一定的参考价值,有需要的朋友们下面来一起看看吧。...2017-07-06
- 每个网管最黑暗的时候莫过于服务器被攻击后的束手无策,其实服务器遭受攻击后,服务器的记录文件详细地记录了黑客活动的蛛丝马迹。...2016-01-27
- 这篇文章主要介绍了iis伪静态中文url出现乱码的解决办法,需要的朋友可以参考下...2017-07-06
- 你的网站是不是常常被黑,或者一不注意就成了黑客的“肉鸡”?对于Web网站服务器来说,如果不进行安全设置,很容易被黑客“盯上”,随时都有被入侵的危险。...2016-01-27
- MyIIS 做了部分,程序只写了些函数(带数据库),具体调用各位写逻辑程序实现...2016-01-27
- 这篇文章主要介绍了IIS自定义404错误页避免暴露.NET网站路径信息,在输入非.aspx页面时,显示默认404页面,暴露站点路径信息,本文就给出了一个解决方法,需要的朋友可以参考下...2016-01-27