Client IP not updating

Hello, I am trying to get the client’s IP to ban specific countries due to regulations, I’m using the following to do so on the server

this.connection.clientAddress

The problem I’m facing is that if a client connects with a VPN from an allowed country the app will let them log in, then they can switch to a banned country and the IP on the server still be the previous one, will like some help if anyone know how to update the connection to get the current IP at all time

Don’t we all have this problem on Earth?! In part this is why VPN solutions have been developed. Then we developed VPN blockers just to immediately invent the VPN Blocker … blocker …
I am afraid this question is not Meteor related and the solution better be searched in a search engine. I think the easiest and most inaccurate solution is to query the IP location and compare it with the browser location/locale settings. If they don’t match, probably a VPN is being used.

1 Like

@paulishca
Thanks for the reply, will try to compare it with the browser like you said, hopefully, I found a good workaround, I just need an efficient one because is matter fo licensing and regulation that clients cant access form specific countries

Thanks for the reply

This is what AWS has to offer on this subject: AWS WAF adds Anonymous IP List for AWS Managed Rules

I remember when I used to work for a corporate 15 years ago, we were all globally in a corporate VPN and we would reach the internet through only one point in UK. Hundreds of offices would be identified as Watford, UK in the internet. I think this is another thing to consider. I don’t know anymore how global corporates VPNs work.

This is a solution from Cloudflare: https://community.cloudflare.com/t/how-to-block-vpn/426381 You could use it to build your own Meteor Firewall and perhaps you could start with this package: GitHub - meteorhacks/sikka: Sikka - A Firewall for Meteor Apps

You can use Docker for having Meteor app available from multiple IP addresses or URLs with same database:

Thanks for the reply as far as IP here is my big issue let say a client is using VPN and IP is 1.1.1.1 then this.connection.clientAddress is giving me 1.1.1.1 is working as expected but let’s say the client login and then turns VPN off and now IP is 2.2.2.2 but in meteor as far client don’t refresh is telling me that this.connection.clientAddress still 1.1.1.1, I don’t care if the client is using VPN as much as per license regulation certain countries need to be blocked, what I don’t understand is why is this.connection.clientAddress not updating in every request