Created
April 4, 2014 04:16
-
-
Save MWers/9968031 to your computer and use it in GitHub Desktop.
Use X-Forwarded-For address if it exists, otherwise use cgi.remote_addr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfset req = GetHttpRequestData() /> | |
<cfif structKeyExists(req.headers, "X-Forwarded-For") | |
AND Len(Trim(req.headers["X-Forwarded-For"])) GT 0> | |
<cfset ipAddress = req.headers["X-Forwarded-For"] /> | |
<cfelse> | |
<cfset ipAddress = cgi.remote_addr /> | |
</cfif> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment