讓iis記錄nginx反向代理的真實ip
一、設(shè)置X-Forwarded-For段
nginx配置示例:
{
location
{
...
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
...
}
}
二、在iis站點上安裝isapi filter
在f5的開發(fā)論壇上找到的,按開發(fā)者的話說,是為了解決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!
相關(guān)文章
Windows Server 2008 R2上部署Exchange Server 2010圖文教程
這兩個產(chǎn)品可謂是09年下半年微軟推出的重頭產(chǎn)品,均為64位架構(gòu),而且其功能和性能遠遠超出了其早期版本,在此不再對這方面的內(nèi)容做過多的描述2013-06-06win2003服務器中創(chuàng)建Web網(wǎng)站虛擬目錄的圖文方法
Windows Server 2003系統(tǒng)中創(chuàng)建的Web網(wǎng)站,其中的所有內(nèi)容一般都存儲在主目錄中。但隨著網(wǎng)站內(nèi)容的不斷豐富,用戶需要把不同層次的內(nèi)容組織成網(wǎng)站主目錄下的子目錄。2010-10-10win2003 防止網(wǎng)卡本地連接被禁用的設(shè)置方法
遠程管理服務器有時候不小心會禁用網(wǎng)卡,那么就需要找機房的人來登錄系統(tǒng)幫忙開啟,無疑為我們增加了許多麻煩。2011-01-01Windows 2008 R2下如何進行Wincache安裝與配置教程
這篇文章主要介紹了Windows 2008 R2下如何進行Wincache安裝與配置教程,需要的朋友可以參考下2016-06-06php對外發(fā)包引發(fā)服務器崩潰的終極解決方法分享[推薦]
據(jù)星外科技原創(chuàng)ip策略,總結(jié)DEDECMS php對外發(fā)包引發(fā)服務器崩潰的終極解決方法,希望可以幫助客戶解決服務器問題,讓網(wǎng)站運行的更好2011-12-12域內(nèi)禁止上某個網(wǎng)站的方法(wpkg.org)
這篇文章主要介紹了域內(nèi)禁止上某個網(wǎng)站的方法(wpkg.org),需要的朋友可以參考下2015-09-09