wazehq / geo_redirect Goto Github PK
View Code? Open in Web Editor NEWRack middleware to redirect clients to hostnames based on geo-location.
License: MIT License
Rack middleware to redirect clients to hostnames based on geo-location.
License: MIT License
Now that #14 is done, coverage is incomplete because lib/geo_redirect/railtie.rb
is not being tested.
The option to allow a 'force' flag which overrides the geo-location mechanism is pretty much hard-coded into the lib.
redirect=1
default).I like how the browsernizer gem is handling config:
You generate an initializer file that passes a config
block to the middleware.
Nice explanation on testing rake tasks here:
http://robots.thoughtbot.com/post/11957424161/test-rake-tasks-like-a-boss
Is just Countries? or can redirect to city state?
lib/tasks/geo_redirect.rb:16 uses the Rails constant.
Obviously there is no need for this.
It would be nice if we could have a config option to choose to store the values in cookies instead of the session.
One reason is that if Devise deletes the session after logout we would lose the preference.
The other reason is that we would want to simply remember the preference across different sessions (useful in some scenarios).
I will provide a PR.
Add an option to specify a log file and use it to throw messages throughout the process.
Is there a way to redirect all the traffic from a location, but not for the entire domain? So for example, i could redirect domain.com traffic except domain.com/pro traffic?
Stop using object.present?
in order to avoid the ActiveSupport dependancy.
Appearances:
lib/geo_redirect.rb:62
lib/geo_redirect.rb:68
lib/geo_redirect.rb:119
I think from Rails 4, when you retrieve a cookie, the value is a string.
IMHO it's better to always convert the value to symbol and to change the current test, to test also a string (I think it's not good to have the :default value, because we cannot store this value in the cookie).
I will provide a PR.
I'm running Rails 4.2.5
Hi, great plugin!
What do you think adding more options for search engine crawlers?
For example skipping redirect for bots. Or skipping redirect for certain user agents.
thank you
Would be cool to have a generator that would just create some template yml file under config/geo_redirect.yml
.
Perhaps even our example file, with some comments and explanations.
e.g. 173.194.35.179, 10.0.0.1will fail because it teis to check for '173.194.35.179, 10.0.0.1' instead of ['173.194.35.179', '10.0.0.1']
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.