본문 바로가기
WAS/JBOSS_WILDFLY

18. Reverse Proxy

by coldplayer83 2025. 8. 6.
728x90
반응형

https://access.redhat.com/solutions/2463121

 

Configure JBoss EAP 7 as Reverse Proxy - Red Hat Customer Portal

Configuration Steps Security / Request Authentication

access.redhat.com

 

 

JBoss EAP 7 버전에서 Reverse Proxy 기능이 릴리즈 되었으며 프록시 핸들러를 생성하여 Proxy Jboss 서비스를 통해 back-end Jboss 서비스로 통신이 가능(7버전부터 서버 버전이 달라도 가능함)
Reverse Proxy 는 네트워크 분리 환경에서 외부 WAS – 내부 WAS 통신에 용이한 구성

 

[reverse-proxy handler 설정]

1. Undertow subsystem에 리버스 프록시 핸들러 추가

/subsystem=undertow/configuration=handler/reverse-proxy=LBProxy/:add(cached-connections-per-thread=5,connection-idle-timeout=60,connections-per-thread=10,max-request-time=-1,problem-server-retry=30,request-queue-size=10,session-cookie-names=JSESSIONID)

옵션은 필요한 내용 선별하여 설정

 

2. remote host에 대한 아웃바운드 소켓 바인딩 설정

/socket-binding-group=standard-sockets/remote-destination-outbound-socket-binding=backend-host1/:add(host=192.168.56.102,port=8009)

 

3. 리버스 프록시 핸들러에 remote hosts 추가

/subsystem=undertow/configuration=handler/reverse-proxy=LBProxy/host=backend-host1/:add(instance-id=AP_node10,outbound-socket-binding=backend-host1,path=/welcome,scheme=ajp)

 

연결하려는 대상 proxy 서버가 여러대인 경우 위의 태그를 복수로 추가 후 outbound socket 추가

ex)

<handlers>
	<file name="welcome-content" path="${jboss.home.dir}/welcome-content"/>
	<reverse-proxy name="LBProxy" connections-per-thread="10" session-cookie-names="JSESSIONID" problem-server-retry="30" request-queue-size="10" max-request-time="-1" cached-connections-per-thread="5" connection-idle-timeout="60">
		<host name="backend-host1" outbound-socket-binding="backend-host1" scheme="ajp" instance-id="AP_node10" path="/welcome"/>
        <host name="backend-host2" outbound-socket-binding="backend-host2" scheme="ajp" instance-id="AP_node20" path="/welcome"/>
	</reverse-proxy>
</handlers>
<outbound-socket-binding name="backend-host1">
	<remote-destination host="192.168.56.102" port="8009"/>
</outbound-socket-binding>
<outbound-socket-binding name="backend-host2">
	<remote-destination host="192.168.56.104" port="8009"/>
</outbound-socket-binding>

 

 

4. default-server의 location 태그에 핸들러 추가

/subsystem=undertow/server=default-server/host=default-host/location=\/welcome/:add(handler=LBProxy)

 

5. 페이지 호출 확인

2번 서버에만 배포되어 있는 어플리케이션을 1번 서버에서 호출 가능

 


 

standalone-ha.xml 파일에서 해당 구성 설정 내용 확인 가능

 

Undertow 서브시스템)

 

아웃바운드 소켓 바인딩)

 

728x90
반응형