Skip to content

Instantly share code, notes, and snippets.

@hgirish
Last active November 20, 2022 07:04
Show Gist options
  • Save hgirish/01767ae017300bfc5a42 to your computer and use it in GitHub Desktop.
Save hgirish/01767ae017300bfc5a42 to your computer and use it in GitHub Desktop.
Find Remote IP Address in Coldfusion when Cloudflare
<cfset remoteAddress = getHttpRequestData().headers["CF-Connecting-IP"] >
<cfif remoteAddress eq ''>
<cfset remoteAddress = getHttpRequestData().headers["X-Forwarded-For"] >
</cfif>
<cfif remoteAddress eq ''>
<cfset remoteAddress = cgi.REMOTE_ADDR >
</cfif>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment