728x90
# 환경
- WAS : WebLogic (ip : 192.168.56.242, port : 8002)
- WEB : OHS (ip : 192.168.56.109, port : 8080)
- WebLogic에서 WebLogic plug in을 false로 설정한 상태.
(false인 경우 WEB은 client ip를 불러온다.)
# source
<%@ page contentType="text/html;charset=euc-kr"%> <%@ page import="java.util.*" %> <%@ page import="java.net.InetAddress" %> <html> <head> <title>header check</title> </head> <body> <% out.println("<h3>Header</h3>"); String ip = request.getHeader("X-FORWARED-FOR"); if (ip == null || ip.length() == 0) { ip = request.getHeader("Proxy-Client-IP"); } if(ip == null || ip.length() == 0) { ip = request.getHeader("WL-Proxy-Client-IP"); } if(ip == null || ip.length() == 0) { ip = request.getRemoteAddr() ; } out.println("Header1 : " + ip); out.println("<br>"); String ip2 = request.getHeader("NS-CLIENT-IP"); if(ip2 == null || ip2.length() == 0) { ip2 = request.getHeader("Proxy-Client-IP"); } if(ip2 == null || ip2.length() == 0) { ip2 = request.getHeader("WL-Proxy-Client-IP"); } if(ip2 == null || ip2.length() == 0) { ip2 = request.getRemoteAddr() ; } out.println("Header2 : " + ip2); %> </body> </html> |
Header1과 Header2는 같은 값을 가짐 (같은 ip를 불러옴)
- WAS 호출
- WAS ~ WEB 호출
==> 기댓값(WAS는 Router IP, WEB은 Client IP)를 화면에 찍은 것을 확인.
728x90
'JAVA > JAVA' 카테고리의 다른 글
JVM memory 모니터링 (1) | 2022.09.23 |
---|---|
JMX (0) | 2022.06.14 |
GC 종류 (0) | 2022.05.30 |
AlwaysPreTouch JVM option (0) | 2022.05.18 |
ClassLoader (0) | 2022.05.10 |