Skip to content

Instantly share code, notes, and snippets.

@JimmySorza
Last active February 13, 2020 21:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JimmySorza/7d31f4deb9a40bdf9cf109c110b170b1 to your computer and use it in GitHub Desktop.
Save JimmySorza/7d31f4deb9a40bdf9cf109c110b170b1 to your computer and use it in GitHub Desktop.
get the true ip client with javascript using cloudfare
var req = new XMLHttpRequest();
req.open('GET', 'https://www.cloudflare.com/cdn-cgi/trace', false);
req.send(null);
if(req.status === 200) {
console.log(req.responseText);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment