{"id":18343426,"url":"https://github.com/cosimo/varnish-accept-language","last_synced_at":"2025-04-06T07:32:36.685Z","repository":{"id":787506,"uuid":"483596","full_name":"cosimo/varnish-accept-language","owner":"cosimo","description":"An experimental VCL extension to squash client Accept-Language headers","archived":false,"fork":false,"pushed_at":"2015-12-20T21:09:53.000Z","size":26,"stargazers_count":41,"open_issues_count":1,"forks_count":11,"subscribers_count":3,"default_branch":"master","last_synced_at":"2023-04-21T10:38:41.401Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://www.streppone.it/cosimo/blog/2010/01/my-opera-front-page-caching-and-varnish-hacking/","language":"Perl","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-22T09:39:21.000Z","updated_at":"2021-04-23T14:28:12.000Z","dependencies_parsed_at":"2022-07-05T15:00:21.660Z","dependency_job_id":null,"html_url":"https://github.com/cosimo/varnish-accept-language","commit_stats":null,"previous_names":[],"tags_count":1,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cosimo%2Fvarnish-accept-language","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cosimo%2Fvarnish-accept-language/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cosimo%2Fvarnish-accept-language/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cosimo%2Fvarnish-accept-language/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cosimo","download_url":"https://codeload.github.com/cosimo/varnish-accept-language/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-11-05T20:36:01.517Z","updated_at":"2024-11-05T20:36:02.566Z","avatar_url":"https://github.com/cosimo.png","language":"Perl","funding_links":[],"categories":[],"sub_categories":[],"readme":"Varnish Accept-Language VCL\n===========================\n\nLast updated: 03/11/2011\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 allows you to normalize and filter all the incoming requests\nAccept-Language headers and reduce them to just the languages your site supports.\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\n\nWhy would you want this?\n------------------------\n\nYour site supports English and Japanese languages.\nYour client browsers will send every possible Accept-Language header on Earth.\nIf you enable \"Vary: Accept-Language\" on Varnish or on your backends,\nthe cache hit ratio will rapidly drop, because of the huge variations\nin Accept-Language contents.\n\nWith this VCL, the Accept-Language header will be \"rewritten\" to just\n\"en\" or \"ja\", depending on your client settings. If no match occurs,\nyou can select a default language.\n\nThe rewritten header is \"X-Varnish-Accept-Language\".\nYou can choose to put this header back in \"Accept-Language\" if you wish.\nIn this way, the normalization will be completely transparent.\n\n\nRequirements\n------------\n\n- gcc, make\n- a recent perl, with `prove'\n\n\nInstructions\n-------------\n\n1) Run 'make' informing the list of languages your site supports\n   and the default fallback in the command line, e.g.\n\n   make DEFAULT_LANGUAGE=en SUPPORTED_LANGUAGES=\"en ja pt pt-br\"\n\n2) Run 'make test'\n   You should see \"All tests successful\" at the end of the execution\n\n3) Install the generated accept-language.vcl in /etc/varnish/\n\n4) At the top of your main VCL file, add the following line:\n\n     include \"/etc/varnish/accept-language.vcl\";\n\n   and then in your vcl_recv() add:\n\n     C{\n     vcl_rewrite_accept_language(sp);\n     }C\n\n   This will parse Accept-Language and insert the final language into the\n   \"X-Varnish-Accept-Language\" header (req.http.X-Varnish-Accept-Language).\n\n6) Restart Varnish\n\n7) Cross your fingers\n\n8) Profit !!\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcosimo%2Fvarnish-accept-language","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcosimo%2Fvarnish-accept-language","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcosimo%2Fvarnish-accept-language/lists"}