[[Web_Undertow_Reference_Guide]]
= Web (Undertow) Reference

HTTP-based applications, including those that use the Jakarta Servlet, Jakarta Pages and Jakarta Standard Tag Libraries specifications, make use of WildFly's `undertow` subsystem. This reference covers aspects of the `undertow` subsystem behavior of interest to application developers.

== Sharing sessions between wars in an ear

ifdef::env-github[]
:tip-caption: :bulb:
:note-caption: :information_source:
:important-caption: :heavy_exclamation_mark:
:caution-caption: :fire:
:warning-caption: :warning:
endif::[]

Undertow allows you to share sessions between wars in an ear, if it is
explicitly configured to do so. Note that if you use this feature your
applications may not be portable, as this is not a standard servlet
feature.

In order to enable this you must include a `shared-session-config`
element in the `jboss-all.xml` file in the META-INF directory of the
ear:

[source,xml,options="nowrap"]
----
<jboss xmlns="urn:jboss:1.0">
    <shared-session-config xmlns="urn:jboss:shared-session-config:2.0">
        <session-config>
            <cookie-config>
                <path>/</path>
            </cookie-config>
        </session-config>
    </shared-session-config>
</jboss>
----

This element is used to configure the shared session manager that will
be used by all wars in the ear. For full details of all the options
provided by this file please see the schema at
https://github.com/wildfly/wildfly/blob/main/undertow/src/main/resources/schema/shared-session-config_2_0.xsd,
however in general it mimics the options that are available in
jboss-web.xml for configuring the session.
