Change env variable to CLIENT_IP_HEADER.
This commit is contained in:
1 parent
b1ced5f32c
commit
b6ab8c381f
1 file changed
+5
-6
+5
-6
@@ -15,8 +15,12 @@ import {
|
||||
let lookup;
|
||||
|
||||
export function getIpAddress(req) {
|
||||
// Custom header
|
||||
if (req.headers[process.env.CLIENT_IP_HEADER]) {
|
||||
return req.headers[process.env.CLIENT_IP_HEADER];
|
||||
}
|
||||
// Cloudflare
|
||||
if (req.headers['cf-connecting-ip']) {
|
||||
else if (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) {
|
||||
// Custom header
|
||||
if (req.headers[process.env.COUNTRY_IP_HEADER]) {
|
||||
return req.headers[process.env.COUNTRY_IP_HEADER];
|
||||
}
|
||||
|
||||
// Cloudflare
|
||||
if (req.headers['cf-ipcountry']) {
|
||||
return req.headers['cf-ipcountry'];
|
||||
|
||||
Reference in new issue
Block a user