Embedded Web Server
Apache ActiveMQ Artemis embeds the Jetty web server. Its main purpose is to host the Management Console. However, it can also host other web applications like the REST interface or even Spring-based web applications (e.g. using Camel).
Configuration
The embedded Jetty instance is configured in etc/bootstrap.xml via the web
element, e.g.:
<web path="web">
<binding uri="http://localhost:8161">
<app url="activemq-branding" war="activemq-branding.war"/>
<app url="artemis-plugin" war="artemis-plugin.war"/>
<app url="console" war="console.war"/>
</binding>
</web>
The web element has the following attributes:
pathThe name of the subdirectory in which to find the web application archives (i.e. WAR files). This is a subdirectory of the broker's home or instance directory.customizerThe name of customizer class to load.rootRedirectLocationThe location to redirect the requests with the root target.webContentEnabledWhether or not the content included in the web folder of the home and the instance directories is accessible. Default is false.
The web element should contain at least one binding element to configure how
clients can connect to the web-server. A binding element has the following
attributes:
uriThe protocol to use (i.e.httporhttps) as well as the host and port on which to listen. This attribute is required.clientAuthWhether or not clients should present an SSL certificate when they connect. Only applicable when usinghttps.passwordCodecThe custom coded to use for unmasking thekeystorePasswordandtrustStorePassword.keyStorePathThe location on disk of the keystore. Only applicable when usinghttps.keyStorePasswordThe password to the keystore. Only applicable when usinghttps. Can be masked usingENC()syntax or by definingpasswordCodec. See more in the password masking chapter.trustStorePathThe location on disk for the truststore. Only applicable when usinghttps.trustStorePasswordThe password to the truststore. Only applicable when usinghttps. Can be masked usingENC()syntax or by definingpasswordCodec. See more in the password masking chapter.includedTLSProtocolsA comma seperated list of included TLS protocols, ie"TLSv1,TLSv1.1,TLSv1.2". Only applicable when usinghttps.excludedTLSProtocolsA comma seperated list of excluded TLS protocols, ie"TLSv1,TLSv1.1,TLSv1.2". Only applicable when usinghttps.includedCipherSuitesA comma seperated list of included cipher suites. Only applicable when usinghttps.excludedCipherSuitesA comma seperated list of excluded cipher suites. Only applicable when usinghttps.
Each web application should be defined in an app element inside an binding element.
The app element has the following attributes:
urlThe context to use for the web application.warThe name of the web application archive on disk.
It's also possible to configure HTTP/S request logging via the request-log
element which has the following attributes:
filenameThe full path of the request log. This attribute is required.appendWhether or not to append to the existing log or truncate it. Boolean flag.extendedWhether or not to use the extended request log format. Boolean flag. Iftruewill use the format%{client}a - %u %t "%r" %s %O "%{Referer}i" "%{User-Agent}i". Iffalsewill use the format%{client}a - %u %t "%r" %s %O. Default isfalse. See the format specification for more details.filenameDateFormatThe log file name date format.retainDaysThe number of days before rotated log files are deleted.ignorePathsRequest paths that will not be logged. Comma delimited list.formatCustom format to use. If set this will overrideextended. See the format specification for more details.
The following options were previously supported, but they were replaced by the
format: logCookie, logTimeZone, logDateFormat, logLocale,
logLatency, logServer, preferProxiedForAddress. All these options are now
deprecated and ignored.
These attributes are essentially passed straight through to the underlying
org.eclipse.jetty.server.CustomRequestLog
and org.eclipse.jetty.server.RequestLogWriter
instances. Default values are based on these implementations.
Here is an example configuration:
<web path="web">
<binding uri="http://localhost:8161">
<app url="activemq-branding" war="activemq-branding.war"/>
<app url="artemis-plugin" war="artemis-plugin.war"/>
<app url="console" war="console.war"/>
</binding>
<request-log filename="${artemis.instance}/log/http-access-yyyy_MM_dd.log" append="true" extended="true"/>
</web>
Proxy Forwarding
The proxies and load balancers usually support X-Forwarded headers
to send information altered or lost when a proxy is involved
in the path of the request. Jetty supports the ForwardedRequestCustomizer
customizer to handle X-Forwarded headers.
Set the customizer attribute via the web element to enable the ForwardedRequestCustomizer customizer, ie:
<web path="web" customizer="org.eclipse.jetty.server.ForwardedRequestCustomizer">
<binding uri="http://localhost:8161">
<app url="activemq-branding" war="activemq-branding.war"/>
<app url="artemis-plugin" war="artemis-plugin.war"/>
<app url="console" war="console.war"/>
</binding>
</web>
Management
The embedded web server can be stopped, started, or restarted via any available
management interface via the stopEmbeddedWebServer, starteEmbeddedWebServer,
and restartEmbeddedWebServer operations on the ActiveMQServerControl
respectively.