Hey gamers, I’m trying to do something similar to http://bot.whatismyipaddress.com
I’m using node.js/express.js. When using
req.ips, it gives me the reverse proxy Glitch IP since I’m using a custom domain. I’m trying to get the IP of who ever visited my site.
/cdn-cgi/trace exists, but I honestly don’t want to fiddle about with that!
That returns the reverse proxy IP address.
Are you using a custom domain?
Yes, forgot to mention that! If I don’t use a custom domain, it works perfectly fine.
I’d really like to know this too.
Title says you are using cloudflare - If so, Cloudflare have their own methods for this. Not sure if there is one for nodejs but there is for apache
Here’s a method with express. It’s using a package for cloudflare and express. Install via npm. Using that code an package it adds a new paramater to the request accessible via:
Here’s the code: https://www.npmjs.com/package/cloudflare-express
Found via: https://stackoverflow.com/a/52027026
Google is a really good tool people. Multiple answers on restoring cloudflare visitor ips using a variety of network architecture and languages
This also returns the reverse proxy IPV6 on a custom domain, however it works on the normal project-name.glitch.me.
Ah. Looks like fly.io or glitch must be messing with the IPs and not Cloudflare. Might be one for email@example.com. You could contact fly.io but I doubt they’d care
They all seem to need sudo. Maybe a feature idea?
This might be a fix in php:
<?php if (isset($_SERVER['HTTP_CF_CONNECTING_IP'])) $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_CF_CONNECTING_IP'];?>
Yep. Just got the same error just now
CloudFlare also has a setting where it will return the clients true IP in a header, but that’s a paid setting.
Still, a 404. And how did you get all of those dev details?
Updated the link, try now lol
What do you mean by dev details?