클라우드플레어의 캐시서버 이용시 IP 적용하기 For ASP > 그누보드5 팁자료실

그누보드5 팁자료실

클라우드플레어의 캐시서버 이용시 IP 적용하기 For ASP 정보

클라우드플레어의 캐시서버 이용시 IP 적용하기 For ASP

첨부파일

F5XFFHttpModule.zip (228.7K) 6회 다운로드 2016-12-16 12:50:03

본문

글쎄요... 혹시나 해서요.. 도움이 되시는 분이 한분이라도 계실까 싶어서요...

클라우드플레어를 사용하는데요 실제 접속자 IP를 가져오고 싶을 경우...
그런데 ASP일 경우 자료가 없더라구요..
물론 클플사이트에 가면 아래와 같은 자료가 있기는 있어요
관련 파일은 업로드 해봅니다.

----------------------------------------------------------------
IIS Module (third party)

Installation

Create a directory for the HTTP Module. Example:
C:\> md c:\HttpModules

Copy the files from the Release build of your target platform (x86 for 32-bit or x64 for 64-bit). Example:
C:\> xcopy <zip_dir>\x64\Release\* c:\HttpModules

Copy the Install-XFF-ps1 PowerShell script to the target directory. Example:
C:\> xcopy <zip_dir>\Install-XFF.ps1 c:\HttpModules

Change directory to the install path
C:\> cd c:\HttpModules

Register the Module with the install script (or via IIS admin).
C:\HttpModules\> .\Install-XFF.ps1 -cmd install -module_path c:\HttpModules\F5XFFHttpModule.dll

The module should now be installed in your top level IIS server Module settings as well as each existing application. You can selectively add/remove them from the IIS admin at this point.

Customization for Cloudflare

The F5 XFF Http Module supports a configuration file named F5XFFHttpModule.ini. It looks in the same directory as the configured .DLL for a file of the same name as it self with the .INI extension. An example file is included but renamed to F5XFFHttpModule.ini.bak. Once you get rid of the ".bak" extension and restart the application the settings will take effect. In this configuration file, you should override the default header name of X-Forwarded-For to CF-Connecting-IP.
-----------------------------------------------------------------------------

그래서 요놈을 적용하려고 하다보니...

아랫놈을 찾게 되어서요.. 굳이 위엣 놈을 삽질하지 않아도 되더라구요...

-----------------------------------------------------------------------------

' ######################################################################
' Function name : getUserIP
' Parameter :
' Return : String
' Description :
' ######################################################################

<%

Function getUserIP()
Dim httpXForwardedFor, remoteAddr
Dim result

httpXForwardedFor = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
remoteAddr = Request.ServerVariables("REMOTE_ADDR")

If httpXForwardedFor = "" OR InStr(httpXForwardedFor, "unknown") > 0 Then
result = remoteAddr
ElseIf InStr(httpXForwardedFor, ",") > 0 Then
result = Mid(httpXForwardedFor, 1, InStr(httpXForwardedFor, ",")-1)
ElseIf InStr(httpXForwardedFor, ";") > 0 Then
result = Mid(httpXForwardedFor, 1, InStr(httpXForwardedFor, ";")-1)
Else
result = httpXForwardedFor
End If

getUserIP = Trim(Mid(result, 1, 30))
End Function

%>
---------------------------------------------------------------------------
근데 그냥 ...

Request.ServerVariables("HTTP_X_FORWARDED_FOR")

요넘을 써도 되더군요..

참고 아래 내용 남깁니다.

----------------------------------------------------------

1. Request.ServerVariables("REMOTE_ADDR")

- 기본 환경변수로 주로 사용
- 일반적인 아이피
 

2. Request.ServerVariables("HTTP_CLIENT_IP")

- 로드밸런싱(L4, L7)을 사용하는 다중웹서버의 경우 사용

- REMOTE_ADDR값은 로드밸런싱서버 아이피

 

3. Request.ServerVariables("HTTP_X_FORWARDED_FOR")

- Proxy를 통해 웹서버에 접근하는 경우 사용
- REMOTE_ADDR값은 Proxy 아이피

-----------------------------------------------------------------
추천
1

댓글 0개

전체 2,431 |RSS
그누보드5 팁자료실 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT