All Projects → meetuparchive → varnish-geoip-plugin

meetuparchive / varnish-geoip-plugin

Licence: other
GeoIP plugin for Varnish

Projects that are alternatives of or similar to varnish-geoip-plugin

webpack-react-boilerplate
A boilerplate for using webpack and react.
Stars: ✭ 33 (+83.33%)
Mutual labels:  deprecated
django-snow
ServiceNow Ticket Management App for Django based projects
Stars: ✭ 16 (-11.11%)
Mutual labels:  deprecated
gulp-styl
Preprocess CSS with Styl
Stars: ✭ 21 (+16.67%)
Mutual labels:  deprecated
snapup-android
Android application to take photos, then post them using the Meetup API.
Stars: ✭ 14 (-22.22%)
Mutual labels:  deprecated
react-i18next-phraseapp
Library support to use react-i18next with the Phrase In-Context Editor - DEPRECATED
Stars: ✭ 14 (-22.22%)
Mutual labels:  deprecated
npmlint
[DEPRECATED] Lint your npm package
Stars: ✭ 57 (+216.67%)
Mutual labels:  deprecated
roweb
⛔ [DEPRECATED] Active at https://github.com/ropensci/roweb2
Stars: ✭ 18 (+0%)
Mutual labels:  deprecated
tooltip
[DEPRECATED] The tooltip that has all the right moves
Stars: ✭ 133 (+638.89%)
Mutual labels:  deprecated
aliyun-direct-mail
[DEPRECATED] 阿里云 DirectMail for Laravel.
Stars: ✭ 26 (+44.44%)
Mutual labels:  deprecated
Optimizely-iOS-SDK
Optimizely Classic iOS SDK. For Optimizely X Mobile go here:
Stars: ✭ 31 (+72.22%)
Mutual labels:  deprecated
homebridge-mi-ac-partner
[DEPRECATED] A Xiaomi Mi ac partner plugin for Homebridge.
Stars: ✭ 29 (+61.11%)
Mutual labels:  deprecated
node-pagerduty
⛔️ DEPRECATED - PagerDuty v2 API Wrapper for Node
Stars: ✭ 19 (+5.56%)
Mutual labels:  deprecated
summit2016-RankingPredict
Deprecated, No more maintained - Deprecated, no longer maintained
Stars: ✭ 34 (+88.89%)
Mutual labels:  deprecated
gulp-rework
Preprocess CSS with Rework
Stars: ✭ 30 (+66.67%)
Mutual labels:  deprecated
DeepDIVA
⛔️ DEPRECATED <Python Framework for Reproducible Deep Learning Experiments>
Stars: ✭ 32 (+77.78%)
Mutual labels:  deprecated
resizeend
Debounced JavaScript resize events
Stars: ✭ 60 (+233.33%)
Mutual labels:  deprecated
inclusify
DEPRECATED - Go CLI which can be used to update the default branch name on any GitHub repo
Stars: ✭ 36 (+100%)
Mutual labels:  deprecated
HTTPClient.jl
DEPRECATED, USE HTTP.jl INSTEAD
Stars: ✭ 17 (-5.56%)
Mutual labels:  deprecated
cmsplugin-filer
DEPRECATED, this project is no longer maintained, see README for more information.
Stars: ✭ 127 (+605.56%)
Mutual labels:  deprecated
biggus
⛔ [DEPRECATED] Virtual large arrays and lazy evaluation.
Stars: ✭ 56 (+211.11%)
Mutual labels:  deprecated

Geocoding Incoming Requests

This package contains the source for a little library used through inline C in Varnish for converting IPs to "Lat,Long" or "City, Region, Country" to be used for custom hashes, backends, translation, etc.

It uses, and relies on the MaxMind GeoIP library available from:

http://www.maxmind.com/app/c

The site includes instructions on how to build the GeoIP library, which must be installed prior to using the library and inline C.

Building

To build the plugin, be sure the GeoIP library is installed and use the following:

$ ./configure
$ make
$ make check
$ sudo make install

The configure script will attempt to find GeoIP, and will also attempt to find the GeoIP City database which is also required. The configure script will search for either the paid version 'GeoIPCity.dat' or the Lite version 'GeoLiteCity.dat' in a few standard locations. If your database is not found, you can tell the configure script exactly where to find it by doing:

$ GEOIP_CITY_DATA=/path/to/data ./configure

make install will install the plugin and it's required files into $(prefix)/lib/varnish/plugins where $(prefix) is customizable by passing --prefix=/usr/local to configure

Making use of the library

If you follow the above steps, and everything goes smoothly, you should end up with geoip_plugin.vcl in $(prefix)/lib/varnish/plugins which can be included in your VCL file like so:

include "$(prefix)/lib/varnish/plugins/geoip_plugin.vcl";

Including geoip_plugin.vcl will define a new sub in your VCL file that must be used, called geocode_and_lookup which can be called in the VCL like so:

call geocode_and_lookup;

This sub will attempt to geocode the client's IP address and if successful, define 2 headers X-GeoIP-LatLong and X-GeoIP-City. If geocoding cannot be done, the header X-GeoIP-Unavailable will be set to '1'.

The format of the headers is as follows:

X-GeoIP-LatLong: -12.900919,10.200939
X-GeoIP-City: Brooklyn, NY, US, 11219

In the case of X-GeoIP-LatLong, an empty string, will be substituted if the information is unavailable.

geocode_and_lookup finishes with return(lookup), as the name indicates, therefore is only valid in places where calling lookup is appropriate.

Note: Varnish will fail to load your VCL if you include the plugin, but do not make use of it. If you do not make a call to geocode_and_lookup do not use the include line.

When the loaded VCL makes use of geoip_plugin.vcl you should see "GeoIP plugin loaded." upon starting varnishd.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].