diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/IpUtils.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/IpUtils.java
index 9ed1317906..271a4a477b 100644
--- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/IpUtils.java
+++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/IpUtils.java
@@ -34,6 +34,7 @@ public class IpUtils {
String ip = null;
try {
ip = request.getHeader("x-forwarded-for");
+ logger.warn("x-forwarded-for:"+ip);
if (StringUtils.isEmpty(ip) || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("Proxy-Client-IP");
}
@@ -46,9 +47,18 @@ public class IpUtils {
if (StringUtils.isEmpty(ip) || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("HTTP_X_FORWARDED_FOR");
}
+ if (StringUtils.isEmpty(ip) || "unknown".equalsIgnoreCase(ip)) {
+ ip = request.getHeader("X-Real-IP");
+ }
if (StringUtils.isEmpty(ip) || "unknown".equalsIgnoreCase(ip)) {
ip = request.getRemoteAddr();
}
+ //对于通过多个代理的情况,第一个IP为客户端真实IP,多个IP按照','分割
+ if (ip != null && ip.length() > 15) { //"***.***.***.***".length() = 15
+ if (ip.indexOf(",") > 0) {
+ ip = ip.substring(0, ip.indexOf(","));
+ }
+ }
} catch (Exception e) {
logger.error("IpUtils ERROR ", e);
}
@@ -58,6 +68,7 @@ public class IpUtils {
/**
* desc:获取本地Ip
+ *
* @return
*/
public static String getServerIp() {
diff --git a/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-dev.yml b/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-dev.yml
index a61c5f93a7..4c00e37218 100644
--- a/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-dev.yml
+++ b/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-dev.yml
@@ -2,7 +2,7 @@ version: "3.7"
services:
epmet-openapi-scan:
container_name: epmet-openapi-scan-dev
- image: 192.168.1.130:10080/epmet-cloud-dev/epmet-openapi-scan:0.3.14
+ image: 192.168.1.130:10080/epmet-cloud-dev/epmet-openapi-scan:0.3.16
ports:
- "8107:8107"
network_mode: host # 不会创建新的网络
diff --git a/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-prod.yml b/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-prod.yml
index 93286925a6..2ad59ed51e 100644
--- a/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-prod.yml
+++ b/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-prod.yml
@@ -2,7 +2,7 @@ version: "3.7"
services:
epmet-openapi-scan:
container_name: epmet-openapi-scan-prod
- image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-openapi-scan:0.3.14
+ image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-openapi-scan:0.3.16
ports:
- "8107:8107"
network_mode: host # 不会创建新的网络
diff --git a/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-test.yml b/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-test.yml
index a969f89828..4e531e43a8 100644
--- a/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-test.yml
+++ b/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-test.yml
@@ -2,7 +2,7 @@ version: "3.7"
services:
epmet-openapi-scan:
container_name: epmet-openapi-scan-test
- image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/epmet-openapi-scan:0.3.14
+ image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/epmet-openapi-scan:0.3.16
ports:
- "8107:8107"
network_mode: host # 不会创建新的网络
diff --git a/epmet-openapi/epmet-openapi-scan/pom.xml b/epmet-openapi/epmet-openapi-scan/pom.xml
index d5768cbe79..41f7844d34 100644
--- a/epmet-openapi/epmet-openapi-scan/pom.xml
+++ b/epmet-openapi/epmet-openapi-scan/pom.xml
@@ -4,7 +4,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
- 0.3.14
+ 0.3.16
epmet-openapi-scan
jar