{"id":13847672,"url":"https://github.com/cosimo/varnish-geoip","last_synced_at":"2025-04-06T07:32:36.846Z","repository":{"id":796011,"uuid":"495019","full_name":"cosimo/varnish-geoip","owner":"cosimo","description":"Varnish VCL \"plugin\" that geolocates client IP addresses (requires geoip)","archived":false,"fork":false,"pushed_at":"2016-02-15T10:34:54.000Z","size":31,"stargazers_count":51,"open_issues_count":4,"forks_count":14,"subscribers_count":13,"default_branch":"master","last_synced_at":"2024-08-05T19:34:31.979Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cosimo.png","metadata":{"files":{"readme":"README","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2010-01-30T13:57:59.000Z","updated_at":"2021-03-09T16:41:10.000Z","dependencies_parsed_at":"2022-07-05T15:02:11.692Z","dependency_job_id":null,"html_url":"https://github.com/cosimo/varnish-geoip","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cosimo%2Fvarnish-geoip","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cosimo%2Fvarnish-geoip/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cosimo%2Fvarnish-geoip/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cosimo%2Fvarnish-geoip/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cosimo","download_url":"https://codeload.github.com/cosimo/varnish-geoip/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223241225,"owners_count":17112105,"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":[],"created_at":"2024-08-04T19:00:27.807Z","updated_at":"2024-11-05T20:36:03.099Z","avatar_url":"https://github.com/cosimo.png","language":"C","funding_links":[],"categories":["C"],"sub_categories":[],"readme":"Varnish Geo-IP VCL\n===========================\n\nLast updated: 28/05/2013\n\tCosimo Streppone \u003ccosimo@opera.com\u003e\n\tOpera Software ASA\n\nHere you will find a VCL config file for Varnish (http://varnish-cache.org)\nThis VCL will transparently add a HTTP request header with Geo-IP information\ndepending on the client IP address that made the request.\n\n*** WARNING ***\nThis VCL consists of C code. Your Varnish might explode. YMMV.\nDon't use it in production if you don't know what you're doing.\nWe are using it in production, but we _don't_ know what we're doing :).\n\nWhy would you want this?\n------------------------\nSo your backend application can just read a HTTP header and figure out\nwhere the client comes from, city, country and latitude/longitude.\nOf course this doesn't come for free. You need the city edition of Geo-IP.\n\nThe rewritten header is \"X-Geo-IP\".\n\nX-Geo-IP header content\n-----------------------\n\nthe `X-Geo-IP` header will differ depending on which function\nyou decide to apply, and what GeoIP database you are using, Country or City\nedition.\n\nIn case of simple country lookup, you will have:\n\n    X-Geo-IP: country:US\n\nwhereas a failed lookup will return `country:A6`. That is an internal\nconvention we adopted, of course YMMV.\n\nIn case of City database, the header will look like:\n\n    X-Geo-IP: city:Rome, country:IT, lat:44.2134, lon:12.241, ip:1.2.3.4\n\n(numbers are made up), while in the lookup failed case, you will have:\n\n    X-Geo-IP: city:, country:A6, lat:0.0, lon:0.0, ip:1.2.3.4\n\nThe invalid/internal IP case is covered by the geoip library itself, so\nit should be reported as unknown IP.\n\nRequirements\n------------\n\n- gcc, make\n- a recent perl, with `prove'\n\nInstructions\n-------------\n\n1) Run 'make \u0026\u0026 make test'\n   You should see \"All tests successful\" at the end of the execution\n\n2) Install the generated geoip.vcl in /etc/varnish/\n\n3) At the top of your main VCL file, add the following line:\n\n     include \"/etc/varnish/geoip.vcl\"\n\n   and then in your vcl_recv() add:\n\n     C{\n     vcl_geoip_set_header(sp);\n     }C\n\n4) If you run Debian, look here:\n\n   http://www.streppone.it/cosimo/blog/2011/11/how-to-start-up-varnish-with-a-custom-cc_command-on-debian/\n\n   for instructions on how to specify a custom \"cc_command\" in\n   the Varnish init script.\n\n5) Restart Varnish\n\n6) ?\n\n7) Profit !!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcosimo%2Fvarnish-geoip","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcosimo%2Fvarnish-geoip","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcosimo%2Fvarnish-geoip/lists"}