JBoss EAP 7 Reverse Proxy 구성


원래대로라면 추천방법을 사용하여 외부망 WEB - 내부망 WAS 형태로 연동하는것을 권장하지만 그게 불가능한 경우에 구성하는 방법이다.
일반적으로 내/외부망이 분리된 곳에서 외부망 서비스를 위해 내부망의 WAS에 프록시로 접근하려고 하는 경우에 고려해볼수 있는 구성이다.
외부망에는 보안상 또는 특정한 사유로 인해 소스나 DB등을 위치시킬수 없는 경우. 아니면 이미 내부에 구현된 서비스를 외부로 서비스하고자 하는 요청이 있는경우 구성하는 형태이다.

  • JBoss EAP 7.x 릴리스에 이 기능이 도입되었습니다.
  • JBoss EAP 6.x 또는 이전 버전은 요청을 프록시 할 수 없습니다. mod_proxy, mod_cluster 또는 mod_jk 모듈 대신 프록시에 Apache httpd를 사용하십시오.

첫 번째 단계는 리버스 프록시 핸들러를 Undertow 서브 시스템에 추가하는 것입니다.
즉 리버스 프록시 역할을 해주는 핸들러를 하나 생성하는단계.

/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)

원격 호스트에 대한 아웃 바운드 소켓 바인딩을 정의하십시오.
리버스 프록싱 하기 위한 타겟 서버 정보를 바인딩 그룹에 추가하도록 한다.

  • 대상서버 : 10.10.10.10
  • 대상포트 : 8109 (AJP)
/socket-binding-group=standard-sockets/remote-destination-outbound-socket-binding=backend-host1/:add(host=10.10.10.10,port=8109)

프록시 핸들러를 리버스하기 위해 원격 백엔드 호스트를 추가하십시오.

  • 대상컨텍스트 : /TestApp
  • 대상인스턴스ID : node1
/subsystem=undertow/configuration=handler/reverse-proxy=LBProxy/host=backend-host1/:add(instance-id=node1,outbound-socket-binding=backend-host1,path=/TestApp,scheme=ajp)

기본 서버의 위치에 핸들러를 추가하십시오.

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

결과 XML 구성은 다음과 같습니다.

  • Undertow 서브 시스템의 경우
<subsystem xmlns="urn:jboss:domain:undertow:3.1">
    <buffer-cache name="default"/>
    <server name="default-server">
        <http-listener name="default" socket-binding="http" redirect-socket="https"/>
        <host name="default-host" alias="localhost">
            <location name="/" handler="welcome-content"/>
            <location name="/TestApp" handler="LBProxy"/>
            <filter-ref name="server-header"/>
            <filter-ref name="x-powered-by-header"/>
        </host>
    </server>
    <servlet-container name="default">
        <jsp-config/>
        <websockets/>
    </servlet-container>
    <handlers>
        <file name="welcome-content" path="${jboss.home.dir}/welcome-content"/>
        <reverse-proxy name="LBProxy" connection-idle-timeout="60">
            <host name="backend-host1" outbound-socket-binding="backend-host1" scheme="ajp" path="/TestApp" instance-id="node1"/>
        </reverse-proxy>
    </handlers>
    <filters>
        <response-header name="server-header" header-name="Server" header-value="JBoss-EAP/7"/>
        <response-header name="x-powered-by-header" header-name="X-Powered-By" header-value="Undertow/1"/>
    </filters>
</subsystem>
  • 아웃 바운드 소켓 바인딩의 경우
<outbound-socket-binding name="backend-host1">
    <remote-destination host="10.10.10.10" port="8109"/>
</outbound-socket-binding>

브라우저가 http://localhost:8080/TestApp을 가리키면 프록시 컨텐츠를 볼 수 있어야합니다.

로그인하면 댓글을 남길 수 있습니다.
  • jboss_eap_7_reverse_proxy_구성.txt
  • 마지막으로 수정됨: 2020/03/17 02:42
  • 저자 koov