{"id":13582033,"url":"https://github.com/aablinov/caddy-geoip","last_synced_at":"2025-04-12T19:33:49.465Z","repository":{"id":55974924,"uuid":"124545442","full_name":"aablinov/caddy-geoip","owner":"aablinov","description":"Caddy plugin to resolve user GeoIP data","archived":false,"fork":false,"pushed_at":"2020-12-03T15:01:38.000Z","size":29186,"stargazers_count":17,"open_issues_count":4,"forks_count":14,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-26T13:46:06.715Z","etag":null,"topics":["caddy-geoip","caddy-plugin","caddyserver"],"latest_commit_sha":null,"homepage":"https://caddyserver.com/docs/http.geoip","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aablinov.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-03-09T13:41:15.000Z","updated_at":"2025-01-09T14:12:34.000Z","dependencies_parsed_at":"2022-08-15T10:40:23.128Z","dependency_job_id":null,"html_url":"https://github.com/aablinov/caddy-geoip","commit_stats":null,"previous_names":["kodnaplakal/caddy-geoip","hiphref/caddy-geoip"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aablinov%2Fcaddy-geoip","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aablinov%2Fcaddy-geoip/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aablinov%2Fcaddy-geoip/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aablinov%2Fcaddy-geoip/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aablinov","download_url":"https://codeload.github.com/aablinov/caddy-geoip/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248621455,"owners_count":21134857,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["caddy-geoip","caddy-plugin","caddyserver"],"created_at":"2024-08-01T15:02:23.780Z","updated_at":"2025-04-12T19:33:49.417Z","avatar_url":"https://github.com/aablinov.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/kodnaplakal/caddy-geoip.svg?branch=master)](https://travis-ci.org/kodnaplakal/caddy-geoip)\n## Overview\n\n`geoip` is a Caddy plugin that allow to determine\nuser Geolocation by IP address using a\n[MaxMind database](https://www.maxmind.com/en/geoip2-services-and-databases).\n\n## Placeholders\n\nThe following placeholders are available:\n\n```\n  geoip_country_code - Country ISO code, example CY for Cyprus\n  geoip_country_geoname_id - GeoNameID of the city, example 146669\n  geoip_latitude - Latitude, example 34.684100\n  geoip_longitude - Longitude, example 33.037900\n  geoip_time_zone - Time zone, example Asia/Nicosia\n  geoip_country_eu - Return 'true' if country in Europen Union\n  geoip_country_name - Full country name\n  geoip_city_name - City name\n  geoip_city_geoname_id - GeoNameID of the city, example 146384\n  geoip_geohash - Geohash of latitude and longitude\n```\n\n## Missing geolocation data\n\nIf there is no geolocation data for an IP address most of the placeholders\nlisted above will be empty. The exceptions are `geoip_country_code`,\n`geoip_country_name`, and `geoip_city_name`. If the request originated over\nthe system loopback interface (e.g., 127.0.0.1) those vars will be set\nto `**`, `Loopback`, and `Loopback` respectively. For any other address,\nincluding private addresses such as 192.168.0.1, the values will be `!!`,\n`No Country`, and `No City` respectively.\n\n## Examples\n\n(1) Set database path and return country code header:\n\n```\ngeoip /path/to/db/GeoLite2-City.mmdb\nheader Country-Code {geoip_country_code}\n```\n\n(2) Proxy pass headers to backend:\n\n```\nlocalhost\ngeoip /path/to/db/GeoLite2-City.mmdb\nproxy / localhost:3000 {\n  header_upstream Country-Name {geoip_country_name}\n  header_upstream Country-Code {geoip_country_code}\n  header_upstream Country-Eu {geoip_country_eu}\n  header_upstream City-Name {geoip_city_name}\n  header_upstream Latitude {geoip_latitude}\n  header_upstream Longitude {geoip_longitude}\n  header_upstream Time-Zone {geoip_time_zone}\n  header_upstream Geohash {geoip_geohash}\n}\n```\n\n(3) Include the geolocation info in the access log:\n\n```\nlog / {$HOME}/log/access.log \"{when_iso} {status} {method} {latency_ms} ms {size} bytes {geoip_country_code} {remote} {host} {proto} \\\"{uri}\\\" \\\"{\u003eUser-Agent}\\\"\"\n```\n\n## Contributing\n\n1. [Fork it](https://github.com/kodnaplakal/caddy-geoip/fork)\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create a new [Pull Request](https://github.com/kodnaplakal/caddy-geoip/pulls)\n\n## Contributors\n\n- [aablinoov](https://github.com/aablinov) Andrey Blinov - creator, maintainer\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faablinov%2Fcaddy-geoip","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faablinov%2Fcaddy-geoip","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faablinov%2Fcaddy-geoip/lists"}