최초등록
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
<%
|
||||
Response.write "aaa=" & remoteIP()
|
||||
Function remoteIP()
|
||||
Dim clientIP
|
||||
|
||||
' 1. X-Forwarded-For 헤더 확인 (프록시 환경에서 가장 우선)
|
||||
clientIP = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
|
||||
|
||||
If clientIP <> "" Then
|
||||
' 여러 프록시를 거친 경우 쉼표로 구분되므로 첫 번째 IP 추출
|
||||
If InStr(clientIP, ",") > 0 Then
|
||||
clientIP = Trim(Split(clientIP, ",")(0))
|
||||
End If
|
||||
remoteIP = clientIP
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
' 2. X-Real-IP 헤더 확인 (Nginx 등에서 사용)
|
||||
clientIP = Request.ServerVariables("HTTP_X_REAL_IP")
|
||||
If clientIP <> "" Then
|
||||
remoteIP = clientIP
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
' 3. CF-Connecting-IP 헤더 확인 (Cloudflare 사용시)
|
||||
clientIP = Request.ServerVariables("HTTP_CF_CONNECTING_IP")
|
||||
If clientIP <> "" Then
|
||||
remoteIP = clientIP
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
' 4. HTTP_CLIENT_IP 확인
|
||||
clientIP = Request.ServerVariables("HTTP_CLIENT_IP")
|
||||
If clientIP <> "" Then
|
||||
remoteIP = clientIP
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
' 5. 기본 REMOTE_ADDR 사용
|
||||
clientIP = Request.ServerVariables("REMOTE_ADDR")
|
||||
remoteIP = clientIP
|
||||
End Function
|
||||
%>
|
||||
Reference in New Issue
Block a user