본문 바로가기
WAS/JBOSS_WILDFLY

28. 핸들러(handler)

by coldplayer83 2025. 12. 15.
728x90
반응형

https://docs.redhat.com/ko/documentation/red_hat_jboss_enterprise_application_platform/7.4/html/configuration_guide/undertow-configure-handlers

 

17.7. 핸들러 구성 | Configuration Guide | Red Hat JBoss Enterprise Application Platform | 7.4 | Red Hat Documentation

Red Hat JBoss Enterprise Application Platform 형식멀티 페이지단일 페이지모든 문서를 PDF로 표시

docs.redhat.com

 

jboss에서는 다음 두 가지 핸들러 구성 가능

- 파일 핸들러 : 정적 파일 제공. tomcat의 DocBase 역할

- reverse proxy 핸들러 : 역방향 프록시

 

기본 Undertow 하위 시스템 구성

<subsystem xmlns="urn:jboss:domain:undertow:10.0" default-server="default-server" default-virtual-host="default-host" default-servlet-container="default" default-security-domain="other">
    <buffer-cache name="default"/>
    <server name="default-server">
    	<host name="default-host" alias="localhost">
            <location name="/" handler="welcome-content"/>
        </host>
    </server>
    <servlet-container name="default">
        ...
    </servlet-container>
    <handlers>
        <file name="welcome-content" path="${jboss.home.dir}/welcome-content"/>
    </handlers>
</subsystem>

 


 

파일 핸들러 설정 방법

standalone-ha.xml에 설정

 

1. location 설정

<location name="${접속uri}" handler="${handler_name}"/>
ex) <location name="/upload" handler="nas"/>

 

2. 파일 핸들러 정의

/subsystem=undertow/configuration=handler/file=${handler_name}:add(path=${handler_path})
ex) /subsystem=undertow/configuration=handler/file=nas:add(path=/data/nas/upload)

! 디렉터리 대신 파일 핸들러의 경로를 직접 설정하는 경우 해당 파일 핸들러를 참조하는 모든 위치 요소가 슬래시(/)로 끝나는 경우 서버에서 404 - 찾을 수 없음 응답을 반환함. /로 끝나지 않도록 주의

 

=> testserver.co.kr/upload 로 접근하는 경우 서버에서는 testserver.co.kr/data/nas/upload 경로에서 파일을 가져옴

 

3. 서버 재기동

 

728x90
반응형