Skip to content

Commit

Permalink
Merge pull request #131 from is0xjh25/check-user-ip
Browse files Browse the repository at this point in the history
Fix: getIp
  • Loading branch information
Lingxiao108105 authored Oct 20, 2021
2 parents 6a010e8 + c86fd85 commit 09ff968
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 3 deletions.
3 changes: 1 addition & 2 deletions src/main/java/tech/crm/crmserver/common/utils/IpUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<MultiValueMap<String, String>> requestEntity = new HttpEntity<>(null, headers);
Expand Down
1 change: 0 additions & 1 deletion src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 09ff968

Please sign in to comment.