Restrict x-umami-client-* headers to cloud mode only.
Some checks failed
Create docker images (cloud) / Build, push, and deploy (push) Has been cancelled
Node.js CI / build (postgresql, 18.18, 10) (push) Has been cancelled

This commit is contained in:
Mike Cao 2026-01-23 20:30:42 -08:00
parent fbd0564133
commit fd2e2047cd
2 changed files with 11 additions and 7 deletions

View file

@ -10,12 +10,16 @@ import { safeDecodeURIComponent } from '@/lib/url';
const MAXMIND = 'maxmind'; const MAXMIND = 'maxmind';
const PROVIDER_HEADERS = [ const PROVIDER_HEADERS = [
// Umami custom headers // Umami custom headers (cloud mode only)
{ ...(process.env.CLOUD_MODE
countryHeader: 'x-umami-client-country', ? [
regionHeader: 'x-umami-client-region', {
cityHeader: 'x-umami-client-city', countryHeader: 'x-umami-client-country',
}, regionHeader: 'x-umami-client-region',
cityHeader: 'x-umami-client-city',
},
]
: []),
// Cloudflare headers // Cloudflare headers
{ {
countryHeader: 'cf-ipcountry', countryHeader: 'cf-ipcountry',

View file

@ -1,5 +1,5 @@
export const IP_ADDRESS_HEADERS = [ export const IP_ADDRESS_HEADERS = [
'x-umami-client-ip', // Umami custom header ...(process.env.CLOUD_MODE ? ['x-umami-client-ip'] : []), // Umami custom header (cloud mode only)
'true-client-ip', // CDN 'true-client-ip', // CDN
'cf-connecting-ip', // Cloudflare 'cf-connecting-ip', // Cloudflare
'fastly-client-ip', // Fastly 'fastly-client-ip', // Fastly