17장. 웹 서버 구성(Undertow)
17.1. Undertow 하위 시스템 개요
JBoss EAP 7에서 undertow
하위 시스템은 JBoss EAP 6에서 웹
하위 시스템을 사용합니다.
The undertow
하위 시스템을 사용하면 웹 서버 및 서블릿 컨테이너 설정을 구성할 수 있습니다. 자카르타 서블릿 4.0 사양과 웹 소켓을 구현합니다. 또한 HTTP 업그레이드를 지원하고 서블릿 배포에서 고성능 비차단 핸들러를 사용할 수 있습니다. 또한 The undertow
하위 시스템에는 mod_cluster를 지원하는 고성능 역방향 프록시 역할을 할 수 있습니다.
undertow
하위 시스템에는 다음 5가지 기본 구성 요소가 있습니다.
JBoss EAP는 이러한 각 구성 요소에 대한 구성을 업데이트하는 기능을 제공하지만 기본 구성은 대부분의 사용 사례에 적합하며 적절한 성능 설정을 제공합니다.
기본 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"> <http-listener name="default" socket-binding="http" redirect-socket="https" enable-http2="true"/> <https-listener name="https" socket-binding="https" security-realm="ApplicationRealm" enable-http2="true"/> <host name="default-host" alias="localhost"> <location name="/" handler="welcome-content"/> <http-invoker security-realm="ApplicationRealm"/> </host> </server> <servlet-container name="default"> <jsp-config/> <websockets/> </servlet-container> <handlers> <file name="welcome-content" path="${jboss.home.dir}/welcome-content"/> </handlers> </subsystem>
또한 The undertow
하위 시스템은 XNIO 작업자 및 버퍼 풀을 제공하기 위해 the io
하위 시스템을 사용합니다. The io
하위 시스템은 별도로 구성되며 대부분의 경우 최적의 성능을 제공해야 하는 기본 구성을 제공합니다.
JBoss EAP 6의 웹
하위 시스템과 비교하여 JBoss EAP 7의 undertow
하위 시스템에는 HTTP 메서드의 다양한 기본 동작이 있습니다.
Undertow 하위 시스템과 함께 Elytron 사용
웹 애플리케이션이 배포되면 해당 애플리케이션에 필요한 보안 도메인의 이름이 식별됩니다. 이는 배포 내에서 발생하거나 배포에 보안 도메인이 없는 경우, the undertow
하위 시스템에 정의된 default-security-domain
을 가정합니다. 기본적으로 보안 도메인은 레거시 보안 하위 시스템에 정의된 PicketBox
에 매핑됩니다. 그러나 application-security-domain
리소스를 애플리케이션에 필요한 보안 도메인의 이름에서 적절한 Elytron 구성으로 매핑하는 undertow
하위 시스템에 추가할 수 있습니다.
예제: 매핑 추가.
/subsystem=undertow/application-security-domain=ApplicationDomain:add(security-domain=ApplicationDomain)
결과가 다음과 같은 경우 매핑이 성공적으로 추가됩니다.
<subsystem xmlns="urn:jboss:domain:undertow:10.0" ... default-security-domain="other"> ... <application-security-domains> <application-security-domain name="ApplicationDomain" security-domain="ApplicationDomain"/> </application-security-domains> ... </subsystem>
- 이 시점에 배포가 이미 배포된 경우 애플리케이션 보안 도메인 매핑을 적용하려면 애플리케이션 서버를 다시 로드해야 합니다.
- 현재 웹 서비스-Elytron 통합에서 웹 서비스 엔드포인트와 Elytron 보안 도메인 이름을 보호하기 위해 지정된 보안 도메인의 이름은 동일해야 합니다.
이 간단한 형식은 배포에서 BASIC
,CLIENT_CERT
,DIGEST
,FORM
과 같은 서블릿 사양에 정의된 표준 HTTP 메커니즘을 사용하는 경우에 적합합니다. 여기서는 ApplicationDomain
보안 도메인에 대해 인증이 수행됩니다. 이 형식은 애플리케이션이 인증 메커니즘을 사용하지 않고 프로그래밍 인증을 사용하거나 배포와 관련된 SecurityDomain
을 가져와 직접 사용하려는 경우에 적합합니다.
예제: 매핑의 고급 양식 :
/subsystem=undertow/application-security-domain=MyAppSecurity:add(http-authentication-factory=application-http-authentication)
결과가 다음과 같은 경우 고급 매핑이 성공적으로 수행됩니다.
<subsystem xmlns="urn:jboss:domain:undertow:10.0" ... default-security-domain="other"> ... <application-security-domains> <application-security-domain name="MyAppSecurity" http-authentication-factory="application-http-authentication"/> </application-security-domains> ... </subsystem>
이 구성에서는 보안 도메인을 참조하지 않고 http-authentication-factory
를 참조합니다. 이 팩토리는 인증 메커니즘의 인스턴스를 가져오는 데 사용되며 보안 도메인과 차례로 연결됩니다.
사용자 지정 HTTP 인증 메커니즘을 사용하거나 주요 변환기, 자격 증명 팩토리 및 메커니즘 영역과 같은 메커니즘에 대해 추가 구성을 정의해야 하는 경우 http-authentication-factory
특성을 참조해야 합니다. 서블릿
사양에 설명된 4개가 아닌 메커니즘을 사용할 때 http-authentication-factory
속성을 참조하는 것이 더 좋습니다.
고급 매핑 형식을 사용하면 또 다른 구성 옵션인 override-deployment-config
를 사용할 수 있습니다. 참조된 http-authentication-factory
는 전체 인증 메커니즘 세트를 반환할 수 있습니다. 기본적으로 애플리케이션에서 요청한 메커니즘과 일치하도록 필터링됩니다. 이 옵션을 true
로 설정하면 팩토리에서 제공하는 메커니즘이 애플리케이션에서 요청한 메커니즘을 재정의합니다.
또한 application-security-domain
리소스에는 하나의 추가 옵션 enable-jacc
가 있습니다. true
로 설정된 경우 이 매핑과 일치하는 모든 배포에 대해 Jakarta Authorization Authorization이 활성화됩니다.
런타임 정보
application-security-domain
매핑이 사용 중인 경우 배포가 예상대로 일치하는지 다시 확인하는 것이 유용할 수 있습니다. include-runtime=true
로 리소스를 읽는 경우 매핑과 연결된 배포도 다음과 같이 표시됩니다.
/subsystem=undertow/application-security-domain=MyAppSecurity:read-resource(include-runtime=true) { "outcome" => "success", "result" => { "enable-jacc" => false, "http-authentication-factory" => undefined, "override-deployment-config" => false, "referencing-deployments" => ["simple-webapp.war"], "security-domain" => "ApplicationDomain", "setting" => undefined } }
이 출력에서 referencing -deployments
특성은 매핑을 사용하여 배포 simple-webapp.war
가 배포되었음을 보여줍니다.