mirror of
https://github.com/umami-software/umami.git
synced 2025-12-08 05:12:36 +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;
|
||||
|
||||
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…
Add table
Add a link
Reference in a new issue