From c86fd853bfb64b45b1288224dcf89c3d5c080e04 Mon Sep 17 00:00:00 2001 From: Lingxiao108105 <71265122+Lingxiao108105@users.noreply.github.com> Date: Wed, 20 Oct 2021 00:47:47 +1100 Subject: [PATCH] Fix: getIp --- src/main/java/tech/crm/crmserver/common/utils/IpUtil.java | 3 +-- src/main/resources/application.yml | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/main/java/tech/crm/crmserver/common/utils/IpUtil.java b/src/main/java/tech/crm/crmserver/common/utils/IpUtil.java index ae9b040..9beee5b 100644 --- a/src/main/java/tech/crm/crmserver/common/utils/IpUtil.java +++ b/src/main/java/tech/crm/crmserver/common/utils/IpUtil.java @@ -76,9 +76,7 @@ public static String getIpAddr(HttpServletRequest request) { if (ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) { ipAddress = request.getHeader("X-Real-IP"); } - logger.info(ipAddress); if (ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) { - logger.info("remoteAddr:" + request.getRemoteAddr()); ipAddress = request.getRemoteAddr(); if (ipAddress.equals("127.0.0.1") || ipAddress.equals("0:0:0:0:0:0:0:1")) { return null; @@ -115,6 +113,7 @@ public static IpAddress sendPostRequest(String ip){ HttpMethod method = HttpMethod.POST; String url = URL + ip; logger.info(url); + headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); HttpEntity> requestEntity = new HttpEntity<>(null, headers); diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 9ea8fac..2c6451f 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -42,7 +42,6 @@ spring: active: https://comp30022-yyds.herokuapp.com/verify default-encoding: utf-8 -debug: true mybatis-plus: typeEnumsPackage: tech.crm.crmserver.common.enums # configuration: