Last active
October 9, 2017 15:35
-
-
Save section-io-gists/57e67547b170f0a3be7c91d8a2e891d4 to your computer and use it in GitHub Desktop.
Language header based on country code.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sub vcl_recv { | |
# Set a X-Language header to spanish is the client is from a spanish speaking country | |
if (req.http.section-io-geo-country ~ "^(AR|BO|CL|CO|CR|CU|DO|EC|SV|GQ|GT|HN|MX|NI|PA|PY|PE|ES|UY|VE)$") { | |
set req.http.X-Language = "Spanish"; | |
} else { | |
set req.http.X-Language = "English"; | |
} | |
} | |
sub vcl_hash { | |
hash_data(req.http.X-Language); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment