|
|
@@ -2,6 +2,8 @@ package com.ruoyi.common.security.feign;
|
|
2
|
2
|
|
|
3
|
3
|
import java.util.Map;
|
|
4
|
4
|
import javax.servlet.http.HttpServletRequest;
|
|
|
5
|
+
|
|
|
6
|
+import com.ruoyi.common.core.utils.ip.IpUtils;
|
|
5
|
7
|
import org.springframework.stereotype.Component;
|
|
6
|
8
|
import com.ruoyi.common.core.constant.CacheConstants;
|
|
7
|
9
|
import com.ruoyi.common.core.utils.ServletUtils;
|
|
|
@@ -40,6 +42,10 @@ public class FeignRequestInterceptor implements RequestInterceptor
|
|
40
|
42
|
{
|
|
41
|
43
|
requestTemplate.header(CacheConstants.AUTHORIZATION_HEADER, authentication);
|
|
42
|
44
|
}
|
|
|
45
|
+
|
|
|
46
|
+ // 配置客户端IP
|
|
|
47
|
+ requestTemplate.header("X-Forwarded-For", IpUtils.getIpAddr(ServletUtils.getRequest()));
|
|
|
48
|
+
|
|
43
|
49
|
}
|
|
44
|
50
|
}
|
|
45
|
51
|
}
|