mirror of
https://github.com/BradNut/umami
synced 2025-09-08 17:40:29 +00: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;
|
||||
|
||||
export function getIpAddress(req: NextApiRequestCollect) {
|
||||
const customHeader = String(process.env.CLIENT_IP_HEADER).toLowerCase();
|
||||
|
||||
// Custom header
|
||||
if (req.headers[process.env.CLIENT_IP_HEADER]) {
|
||||
return req.headers[process.env.CLIENT_IP_HEADER];
|
||||
if (customHeader !== 'undefined' && req.headers[customHeader]) {
|
||||
return req.headers[customHeader];
|
||||
}
|
||||
// Cloudflare
|
||||
else if (req.headers['cf-connecting-ip']) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue