mirror of
https://github.com/umami-software/umami.git
synced 2026-02-06 21:57:16 +01:00
Check Cloudflare headers for country info. Closes #2129
This commit is contained in:
parent
b0b96b34a7
commit
ccafb03c47
6 changed files with 15 additions and 89 deletions
|
|
@ -62,6 +62,14 @@ export async function getLocation(ip, req) {
|
|||
return;
|
||||
}
|
||||
|
||||
// Cloudflare headers
|
||||
if (req.headers['cf-ipcountry']) {
|
||||
return {
|
||||
country: req.headers['cf-ipcountry'],
|
||||
};
|
||||
}
|
||||
|
||||
// Vercel headers
|
||||
if (req.headers['x-vercel-ip-country']) {
|
||||
const country = req.headers['x-vercel-ip-country'];
|
||||
const region = req.headers['x-vercel-ip-country-region'];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue