I was visiting an e-gaming customer a few weeks back and they mentioned they needed to add geographic restrictions to some of their e-gamingapplications to comply with licenses and laws in many countries.
They were about to spend several hundreds of thousands of dollars modifying their application to to this. They were going to have to purchase a license for a geographic IP address services and develop code to validate incoming requests to lookup client IP addresses against a list of permitted countries per application.
Their use case was pretty simple:
- Always allow access to requests from a list of permitted countries;
- Always deny access to requests from a list of denied countries;
- If the request comes from a country other than those expressly allowed or denied, only let the user in if they are authenticated.
I mused that I could solve the problem for them in a few hours with Traffic Script - and they duly accepted my challenge.
So several hours later, the following Traffic Script (or something like it anyway) was born: Geo Restrict Traffic Script
Now, to make this script a little more useful for you out here in the community, I have added blank sub routines so that you can define exactly what you want it to do when you allow or deny a connection and I have left a blank sub routine for you to put some traffic script in to validate the cookie (more on that in a future post when we cover encrypting and decrypting cookies)
But for now, I leave you with yet another example where Traffic Script has given people the power to save real money...
As always, comments and feedback welcome..
Happy Traffic Scripting!