mirror of
https://github.com/kremalicious/umami.git
synced 2024-11-24 11:01:38 +01:00
Lowercase before checking headers. Closes #2634.
This commit is contained in:
parent
a5362d9197
commit
a933f5b4a0
@ -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 New Issue
Block a user