mirror of
https://github.com/umami-software/umami.git
synced 2026-02-10 15:47:13 +01:00
Lowercase before checking headers. Closes #2634.
This commit is contained in:
parent
a5362d9197
commit
a933f5b4a0
1 changed files with 4 additions and 2 deletions
|
|
@ -17,9 +17,11 @@ import { NextApiRequestCollect } from 'pages/api/send';
|
||||||
let lookup;
|
let lookup;
|
||||||
|
|
||||||
export function getIpAddress(req: NextApiRequestCollect) {
|
export function getIpAddress(req: NextApiRequestCollect) {
|
||||||
|
const customHeader = String(process.env.CLIENT_IP_HEADER).toLowerCase();
|
||||||
|
|
||||||
// Custom header
|
// Custom header
|
||||||
if (req.headers[process.env.CLIENT_IP_HEADER]) {
|
if (customHeader !== 'undefined' && req.headers[customHeader]) {
|
||||||
return req.headers[process.env.CLIENT_IP_HEADER];
|
return req.headers[customHeader];
|
||||||
}
|
}
|
||||||
// Cloudflare
|
// Cloudflare
|
||||||
else if (req.headers['cf-connecting-ip']) {
|
else if (req.headers['cf-connecting-ip']) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue