randydev commited on
Commit
5b96bf9
·
verified ·
1 Parent(s): 01adebf

Update middleware/midware.js

Browse files
Files changed (1) hide show
  1. middleware/midware.js +6 -1
middleware/midware.js CHANGED
@@ -11,6 +11,7 @@ class CheckMilWare {
11
  const xForwardedFor = req.headers['x-forwarded-for'];
12
  const xRealIP = req.headers['x-real-ip'];
13
  const cfConnectingIP = req.headers['cf-connecting-ip'];
 
14
  let realIP = req.ip;
15
 
16
  if (xForwardedFor) {
@@ -33,7 +34,11 @@ class CheckMilWare {
33
  await this.dbClient.AddIpisBlocked(realIP);
34
  return res.status(403).send("Access denied: IP is blocked..");
35
  }
36
- console.log(`Real IP address is: ${realIP}, path method: ${req.path}, header used: ${xForwardedFor ? "x-forwarded-for" : xRealIP ? "x-real-ip" : cfConnectingIP ? "cf-connecting-ip" : "req.ip"}`);
 
 
 
 
37
 
38
  next();
39
  } catch (error) {
 
11
  const xForwardedFor = req.headers['x-forwarded-for'];
12
  const xRealIP = req.headers['x-real-ip'];
13
  const cfConnectingIP = req.headers['cf-connecting-ip'];
14
+ const XproxiedPath = req.headers['x-proxied-path'];
15
  let realIP = req.ip;
16
 
17
  if (xForwardedFor) {
 
34
  await this.dbClient.AddIpisBlocked(realIP);
35
  return res.status(403).send("Access denied: IP is blocked..");
36
  }
37
+ console.log(`Real IP address is: ${realIP}
38
+ path method: ${req.path}
39
+ full method: ${XproxiedPath}
40
+ header used: ${xForwardedFor ? "x-forwarded-for" : xRealIP ? "x-real-ip" : cfConnectingIP ? "cf-connecting-ip" : "req.ip"}
41
+ `);
42
 
43
  next();
44
  } catch (error) {