mirror of
https://github.com/kremalicious/umami.git
synced 2024-12-18 15:23:38 +01:00
Change env variable to CLIENT_IP_HEADER.
This commit is contained in:
parent
b1ced5f32c
commit
b6ab8c381f
@ -15,8 +15,12 @@ import {
|
|||||||
let lookup;
|
let lookup;
|
||||||
|
|
||||||
export function getIpAddress(req) {
|
export function getIpAddress(req) {
|
||||||
|
// Custom header
|
||||||
|
if (req.headers[process.env.CLIENT_IP_HEADER]) {
|
||||||
|
return req.headers[process.env.CLIENT_IP_HEADER];
|
||||||
|
}
|
||||||
// Cloudflare
|
// Cloudflare
|
||||||
if (req.headers['cf-connecting-ip']) {
|
else if (req.headers['cf-connecting-ip']) {
|
||||||
return req.headers['cf-connecting-ip'];
|
return req.headers['cf-connecting-ip'];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,11 +56,6 @@ export function getDevice(screen, browser, os) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function getCountry(req, ip) {
|
export async function getCountry(req, ip) {
|
||||||
// Custom header
|
|
||||||
if (req.headers[process.env.COUNTRY_IP_HEADER]) {
|
|
||||||
return req.headers[process.env.COUNTRY_IP_HEADER];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Cloudflare
|
// Cloudflare
|
||||||
if (req.headers['cf-ipcountry']) {
|
if (req.headers['cf-ipcountry']) {
|
||||||
return req.headers['cf-ipcountry'];
|
return req.headers['cf-ipcountry'];
|
||||||
|
Loading…
Reference in New Issue
Block a user