Undertow WildFly Subsystem Configuration: Difference between revisions
(33 intermediate revisions by the same user not shown) | |||
Line 13: | Line 13: | ||
... | ... | ||
<subsystem xmlns="urn:jboss:domain:undertow:3.0"> | <subsystem xmlns="urn:jboss:domain:undertow:3.0"> | ||
<buffer-cache name="default"/> | <buffer-cache name="default"/> | ||
<server name="default-server"> | <server name="default-server"> | ||
<http-listener name="default" redirect-socket="https" socket-binding="http"/> | |||
<http-listener name="default" | |||
worker="default" | |||
redirect-socket="https" | |||
socket-binding="http"/> | |||
<host name="default-host" alias="localhost"> | <host name="default-host" alias="localhost"> | ||
<location name="/" handler="welcome-content"/> | <location name="/" handler="welcome-content"/> | ||
Line 48: | Line 55: | ||
==server== | ==server== | ||
===http-listener=== | ===http-listener=== | ||
Note that the this http listener is also used by JBoss Remoting HTTP connector, so if the name of the listener changes, the <tt>[[Remoting WildFly Subsystem Configuration#JBoss Remoting http-connector|http-connector's connector-ref]]</tt> should be changed accordingly. | Note that the this http listener is also used by JBoss Remoting HTTP connector, so if the name of the listener changes, the <tt>[[Remoting WildFly Subsystem Configuration#JBoss Remoting http-connector|http-connector's connector-ref]]</tt> should be changed accordingly. | ||
Line 55: | Line 60: | ||
====name==== | ====name==== | ||
====worker==== | ====worker==== | ||
The HTTP listener uses the XNIO Worker declared and configured by the [[io WildFly Subsystem|io subsystem]]. The XNIO worker's configuration is described here: [[io WildFly Subsystem Configuration|io subsystem worker configuration]]. The default value is "default". | |||
====redirect-socket==== | ====redirect-socket==== | ||
====socket-binding==== | ====socket-binding==== | ||
====record-request-start-time==== | |||
By default, the request start time is not recorded, so request duration can't be calculated to be reported by the access log. In order to be able to get request duration, we need to enable request start time (<tt>record-request-start-time="true"</tt>) as follows, on ''each'' listener we need to collect statistics from: | |||
<pre> | |||
<subsystem xmlns="urn:jboss:domain:undertow:1.1"> | |||
... | |||
<server name="default-server" > | |||
<http-listener name="http" ... record-request-start-time="true"/> | |||
<ajp-listener name="ajp" ... record-request-start-time="true"/> | |||
... | |||
</server> | |||
</subsystem> | |||
</pre> | |||
%D and %T access log elements will work only after <tt>record-request-start-time</tt> is turned on . For more details see [[Undertow WildFly Subsystem Configuration - access-log#.25D|access-log %D]] and [[Undertow WildFly Subsystem Configuration - access-log#.25T|access-log %T]]. Note that if both <tt>ajp-listener</tt> and <tt>http-listener</tt> are used, <tt>record-request-start-time="true"</tt> must be set on '''both''' of them. | |||
===ajp-listener=== | |||
====record-request-start-time==== | |||
<blockquote style="background-color: #f9f9f9; border: solid thin lightgrey;"> | |||
:See http-listener's [[#record-request-start-time|<tt>record-request-start-time</tt>]] | |||
</blockquote> | |||
===host=== | ===host=== | ||
====location==== | |||
====filter-ref==== | |||
Specifies the name of a filter declared below in the <tt><filters/></tt> section. | |||
If more than one filter is specified here, the filters are executed in the order of their declared priority. | |||
====access-log==== | |||
Configures Undertow to generate access logs according to a certain pattern. The functionality is similar to Tomcat's <tt>AccessLogValve</tt>. For more details see [[Tomcat Configuration]]. | |||
<blockquote style="background-color: #f9f9f9; border: solid thin lightgrey;"> | |||
:[[Undertow WildFly Subsystem Configuration - access-log|<tt>access-log</tt> Configuration Details]] | |||
</blockquote> | |||
==servlet-container== | ==servlet-container== | ||
==handlers== | ==handlers== | ||
==filters== | |||
=Configuring Filters= | =Configuring Filters= | ||
Line 74: | Line 120: | ||
:[[Configuring a Custom Undertow Filter in WildFly]] | :[[Configuring a Custom Undertow Filter in WildFly]] | ||
</blockquote> | </blockquote> | ||
==Adding a RequestDumper== | |||
<font color=red>TODO: not tested yet.</font> | |||
<pre> | |||
... | |||
<host name="default-host" > | |||
... | |||
<filter-ref name="request-dumper"/> | |||
</host> | |||
... | |||
<filters> | |||
... | |||
<filter name="request-dumper" class-name="io.undertow.server.handlers.RequestDumpingHandler" module="io.undertow.core"/> | |||
</filters> | |||
... | |||
</pre> | |||
=Subjects= | |||
* [[Adding a Secure https Listener to Undertow]] |
Latest revision as of 14:02, 16 March 2017
External
- EAP 7.0 Beta Configuration Guide https://access.redhat.com/documentation/en/red-hat-jboss-enterprise-application-platform/7.0.beta/configuration-guide/chapter-9-configuring-the-web-server-undertow
Internal
Overview
... <subsystem xmlns="urn:jboss:domain:undertow:3.0"> <buffer-cache name="default"/> <server name="default-server"> <http-listener name="default" worker="default" redirect-socket="https" socket-binding="http"/> <host name="default-host" alias="localhost"> <location name="/" handler="welcome-content"/> <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"/> </handlers> <filters> <response-header name="server-header" header-value="JBoss-EAP/7" header-name="Server"/> <response-header name="x-powered-by-header" header-value="Undertow/1" header-name="X-Powered-By"/> </filters> </subsystem> ...
Schema
Configuration Elements
buffer-cache
server
http-listener
Note that the this http listener is also used by JBoss Remoting HTTP connector, so if the name of the listener changes, the http-connector's connector-ref should be changed accordingly.
name
worker
The HTTP listener uses the XNIO Worker declared and configured by the io subsystem. The XNIO worker's configuration is described here: io subsystem worker configuration. The default value is "default".
redirect-socket
socket-binding
record-request-start-time
By default, the request start time is not recorded, so request duration can't be calculated to be reported by the access log. In order to be able to get request duration, we need to enable request start time (record-request-start-time="true") as follows, on each listener we need to collect statistics from:
<subsystem xmlns="urn:jboss:domain:undertow:1.1"> ... <server name="default-server" > <http-listener name="http" ... record-request-start-time="true"/> <ajp-listener name="ajp" ... record-request-start-time="true"/> ... </server> </subsystem>
%D and %T access log elements will work only after record-request-start-time is turned on . For more details see access-log %D and access-log %T. Note that if both ajp-listener and http-listener are used, record-request-start-time="true" must be set on both of them.
ajp-listener
record-request-start-time
- See http-listener's record-request-start-time
host
location
filter-ref
Specifies the name of a filter declared below in the <filters/> section.
If more than one filter is specified here, the filters are executed in the order of their declared priority.
access-log
Configures Undertow to generate access logs according to a certain pattern. The functionality is similar to Tomcat's AccessLogValve. For more details see Tomcat Configuration.
servlet-container
handlers
filters
Configuring Filters
Configuring a Custom Undertow Filter in WildFly
Adding a RequestDumper
TODO: not tested yet.
... <host name="default-host" > ... <filter-ref name="request-dumper"/> </host> ... <filters> ... <filter name="request-dumper" class-name="io.undertow.server.handlers.RequestDumpingHandler" module="io.undertow.core"/> </filters> ...