[ java ] client ip 얻기

JooKit 주킷 2022. 3. 7. 01:02
목차 접기
728x90
반응형
tring ip = request.getHeader("X-FORWARDED-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();


InetAddress addr = InetAddress.getByName("www.naver.com"); // 도메인을 ip로 변환
System.out.println("addr : " + addr); // www.naver.com 은 예시
728x90
반응형
LIST