Cloudflare 프록시 환경의 관리자 IP 판별 보정
This commit is contained in:
@@ -225,6 +225,9 @@ function normalizeIp(value) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function clientIp(req) {
|
function clientIp(req) {
|
||||||
|
const cloudflareIp = normalizeIp(req.get("cf-connecting-ip") || "");
|
||||||
|
if (cloudflareIp) return cloudflareIp;
|
||||||
|
|
||||||
const forwarded = String(req.get("x-forwarded-for") || "")
|
const forwarded = String(req.get("x-forwarded-for") || "")
|
||||||
.split(",")
|
.split(",")
|
||||||
.map(normalizeIp)
|
.map(normalizeIp)
|
||||||
|
|||||||
Reference in New Issue
Block a user