Skip to content

Fork from afreeorange/ip-to-location repo for including the situation the application is after a Reverse Proxy.

License

Notifications You must be signed in to change notification settings

hxyconan/iptogeo

Repository files navigation

IPTOGEO

An API interface forked from afreeorange/ip-to-location to get geo information via given IP or reading from request header.

How to use

Features

  • The API service run as an uwsgi backend application
  • It support Reverse Proxy situation, which the uwsgi service will use X-FORWARDED-FOR request header after proxy
  • It will download latest MaxMind DB when service started/restart
  • Response data in json string, example in screenshots

UI

UI

Running emperor.uwsgi.service vassal

  • Copy the iptogeo_emperor_vassal_uwsgi.ini.default to /etc/uwsgi-emperor/vassals/iptogeo.ini then this API will be managed by emperor.uwsgi.service
  • Boot the uWSGI API application
systemctl start|restart|stop|status emperor.uwsgi.service
  • The /etc/uwsgi-emperor/vassals/iptogeo.ini includes a UWSGI hardcode hook: exec-pre-app which will downlad the maxmind db before app load
  • uWSGI service runs at special port in backend, Nginx need to be installed for proxy the request to such special backend port
  • Copy iptogeo_nginx.conf.default to /etc/ngix/sites-enabled/iptogeo.conf for setup nginx to listen all requests from port 80

TODO

  • How to move this API to AWS Lambda service for more elastic and cheaper

About the forked ip-to-location repo

License

Copyright (c) 2010-2016 Bob Huang, https://github.com/hxyconan/iptogeo

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

Fork from afreeorange/ip-to-location repo for including the situation the application is after a Reverse Proxy.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages