Location>code7788 >text

What are the key configuration items in Tomcat's configuration file and what do they do?

Popularity:872 ℃/2024-08-26 23:41:12

Tomcat's configuration file mainly consists ofrespond in singingThey are located in the Tomcat installation directory in theconfThe following are some of the key configuration items and their roles. Today's content focuses on the configuration of the file, V Brother will be combined with some business scenarios, I hope to help you, the following are some key configuration items and their roles:

The configuration item in the

  1. <Server>: The root element, which defines the configuration of the Tomcat server.

    • port: Used to set the port of Tomcat server, the default is 8005.
  2. <Service>: An element that defines a service and contains one or more<Connector>cap (a poem)<Engine>

    • name: The name of the service.
    • port: The port on which the service listens.
  3. <Connector>: Defines the configuration of the HTTP connection.

    • port: The port for HTTP connections, the default is 8080.
    • protocol: The protocol used for the connection, such as HTTP/1.1.
    • redirectPort: The port to which non-SSL requests are redirected when SSL is used.
  4. <Engine>: Defines the configuration of the engine, which is a component of Tomcat used to route requests to the corresponding<Host>

    • defaultHost: Default hostname.
  5. <Host>: Defines the configuration of the virtual host.

    • name: The name of the virtual host, either a domain name or an IP address.
    • appBase: The base directory for the application.
    • unpackWAR: Whether to decompress WAR files.
  6. <Context>: Defines the contextual configuration of the Web application.

    • path: The path to the Web application.
    • docBase: The path to the base directory or WAR file for the web application.
    • reloadable: Whether to allow the application to be reloaded.
  7. <Listener>: Define server listeners to perform start and stop operations.

  8. <Realm>: Define security domains for authentication and authorization.

  9. <Valve>: Defines valves during request processing that can intercept or process requests.

1. <server>

<Server>element is the Tomcat configuration filewhich contains configuration information for the entire Tomcat server. The following are some specific business scenarios and the corresponding<Server>Configuration example:

Scenario 1: Development Environment

In a development environment, we usually want the Tomcat server to restart quickly for development and testing. Therefore, a short JVM pause time can be configured for quick response in case of an error.

<Server port="8005" shutdown="SHUTDOWN">
  <Listener className="" />
  <Listener className="" />
  <Listener className="" />
  <Listener className="" />
  <GlobalNamingResources>
    <!-- Allocation of resources -->
  </GlobalNamingResources>
</Server>

Scenario 2: Production environment

In production environments, stability and security are primary considerations. Therefore, it may be necessary to configure longer JVM suspend times to minimize the number of restarts, as well as SSL certificates to support HTTPS.

<Server port="8005" shutdown="SHUTDOWN">
  <Listener className="" />
  <!-- Other listener configurations -->
  <GlobalNamingResources>
    <!-- configureSSLcertificates -->
    <Resource name="UserDatabase" auth="Container"
      type=""
      description="User database that can be updated and saved"
      factory=""
      pathname="conf/" />
  </GlobalNamingResources>
  <!-- configureSSLconnectors -->
  <Connector port="8443" protocol=".http11.Http11NioProtocol"
             scheme="https" secure="true" SSLEnabled="true"
             keystoreFile="/path/to/" keystorePass="password" />
</Server>

Scenario 3: Load Balancing

If the Tomcat server is used as part of a load-balanced cluster, you may need to configure specific ports for cluster communication, for example, using Tomcat's cluster deployment protocol.

<Server port="8005" shutdown="SHUTDOWN">
  <!-- Configuring Cluster Listeners -->
  <Listener className="" />
  <GlobalNamingResources>
    <!-- Configuring Cluster-Related Resources -->
  </GlobalNamingResources>
  <!-- Configuring Services and Engines -->
  <Service name="CatalinaCluster">
    <Engine name="clusterEngine" defaultHost="localhost" jvmRoute="jvm1">
      <!-- configureConnectorrespond in singingHost -->
    </Engine>
  </Service>
</Server>

Scenario 4: Multi-Instance Deployment

In scenarios where multiple instances of Tomcat need to be deployed on the same server, each instance can be configured with different<Server>Ports.

<Server port="8006" shutdown="SHUTDOWN">;
  <! -- Configure listeners and resources for the first Tomcat instance -->
</Server>
<Server port="8007" shutdown="SHUTDOWN"> <!
  <! -- Configure listeners and resources for the second Tomcat instance -->
</Server>

2. <Service>

<Service>element in Tomcat'sThe configuration file defines a service that takes one or more connectors (<Connector>) with an engine (<Engine>) associated with it. The following business scenarios are based on the<Service>Configuration example:

Scenario 1: Single Instance Application

For most basic applications, you will probably only need one instance of the service to handle all HTTP requests. The following is a basic<Service>Configuration:

<Service name="Catalina">
  <Connector port="8080" protocol="HTTP/1.1"
             connectionTimeout="20000"
             redirectPort="8443" />
  <Engine name="Catalina" defaultHost="localhost">
    <!-- Other configurations,as ifHostet al. (and other authors) -->
  </Engine>
</Service>

Scenario 2: SSL-enabled HTTPS service

If your application needs to provide a secure connection over HTTPS, you need to configure an SSL-enabled<Connector>

<Service name="Catalina">
  <Connector port="8443" protocol=".http11.Http11NioProtocol"
             SSLEnabled="true"
             keystoreFile="/path/to/"
             keystorePass="your_keystore_password"
             scheme="https" secure="true" />
  <Engine name="Catalina" defaultHost="localhost">
    <!-- Other configurations -->
  </Engine>
</Service>

Scenario 3: Load Balancing

In a load balancing scenario, you may need multiple service instances to handle requests. Each service can be bound to a different port and configured to handle different types of requests:

<Service name="CatalinaCluster">
  <Connector port="8080" protocol="HTTP/1.1" redirectPort="8443" />
  <Engine name="Catalina" defaultHost="loadbalancer" jvmRoute="node1">
    <Cluster className="" />
    <Host name="loadbalancer" appBase="webapps" unpackWARs="true" autoDeploy="true">
      <!-- Load Balancer Configuration -->
    </Host>
  </Engine>
</Service>

Scenario 4: Multiple Web Applications

If you need to run multiple web applications on the same server, you can configure each application with a different<Service>

<Service name="Catalina1">
  <Connector port="8081" protocol="HTTP/1.1" />
  <Engine name="Catalina1" defaultHost="">
    <Host name="" appBase="webapp1" unpackWARs="true" autoDeploy="true">
      <!-- appliance1specifications -->
    </Host>
  </Engine>
</Service>

<Service name="Catalina2">
  <Connector port="8082" protocol="HTTP/1.1" />
  <Engine name="Catalina2" defaultHost="">
    <Host name="" appBase="webapp2" unpackWARs="true" autoDeploy="true">
      <!-- appliance2specifications -->
    </Host>
  </Engine>
</Service>

Scenario 5: High Availability Configuration

In business scenarios that require high availability, multiple service instances can be configured, each running on a different port and managed through a cluster manager:

<Service name="CatalinaHA">
  <Connector port="8080" protocol="HTTP/1.1" redirectPort="8443" />
  <Engine name="Catalina" defaultHost="" jvmRoute="node1">
    <Cluster className="">
      <Channel className="">
        <Member className=""
                host="node2"
                port="4000" />
      </Channel>
    </Cluster>
    <Host name="" appBase="webapps" unpackWARs="true" autoDeploy="true">
      <!-- Configuration of High Availability Applications -->
    </Host>
  </Engine>
</Service>

3. <Connector>

<Connector>element in Tomcat'sThe configuration file defines the server's network connection parameters, which are used to process HTTP requests from clients. The following are based on different business scenarios<Connector>Configuration example:

Scenario 1: HTTP service

For basic HTTP services, you need to configure a standard HTTP connector:

<Connector port="8080" protocol="HTTP/1.1"
           connectionTimeout="20000"
           redirectPort="8443" />
  • port: Set the port on which the HTTP service listens.
  • protocol: Specify the protocol to use, here Tomcat's HTTP/1.1 processor is used.
  • connectionTimeout: Request timeout in milliseconds.
  • redirectPort: The HTTPS port to redirect to when the client uses HTTP requests.

Scenario 2: HTTPS service

If your application needs to provide an encrypted connection over HTTPS, you need to configure a connector that supports SSL:

<Connector port="8443" protocol=".http11.Http11NioProtocol"
           connectionTimeout="20000"
           scheme="https" secure="true"
           SSLEnabled="true"
           keystoreFile="conf/"
           keystorePass="changeit" />
  • scheme: Set tohttpsIndicates the use of a secure connection.
  • secure: Set totrueIndicates that the request requires a secure connection.
  • SSLEnabled: Set totrueto enable SSL.
  • keystoreFile: Specifies the path to the keystore file containing the SSL certificate.
  • keystorePass: The password for the keystore.

Scenario 3: Performance Optimization

For applications that need to handle a large number of concurrent requests, the connector can be configured with NIO (non-blocking I/O) or NIO2 to improve performance:

<Connector port="8080" protocol=".http11.Http11NioProtocol"
           connectionTimeout="20000"
           maxThreads="150" minSpareThreads="25"
           acceptCount="100" />
  • maxThreads: Maximum number of worker threads.
  • minSpareThreads: Minimum number of idle threads to keep running.
  • acceptCount: The length of the request queue that can be accepted.

Scenario 4: Limiting request size

To prevent the server from being slowed down by large file uploads, you can limit the maximum size of requests:

<Connector port="8080" protocol="HTTP/1.1"
           maxPostSize="20971520" />
  • maxPostSize: Maximum POST request size, set to 20MB here.

Scenario 5: Enabling GZIP Compression

To reduce the amount of data transferred over the network, the connector can be configured to enable GZIP compression:

<Connector port="8080" protocol="HTTP/1.1"
           compression="on"
           compressionMinSize="2048"
           noCompressionUserAgent="gozilla, traviata" />
  • compression: Set toonto enable compression.
  • compressionMinSize: Minimum request size (in bytes) with compression enabled.
  • noCompressionUserAgent: A list of browsers that do not apply compression.

Scenario 6: Configuring Proxy Settings

If your Tomcat server sits behind one or more proxies, you may need to configure the connector to handle request headers correctly:

<Connector port="8080" protocol="HTTP/1.1"
           proxyName=""
           proxyPort="80"
           scheme="http"
           secure="false" />
  • proxyName: The hostname of the proxy server.
  • proxyPort: The port on which the proxy server listens.

4. <Engine>

<Engine>element in Tomcat'sThe configuration file represents a request engine, which is responsible for receiving the<Service>hit the nail on the head<Connector>forwarded request and routes the request to the appropriate<Host>maybe<Context>. The following business scenarios are based on the<Engine>Configuration example:

Scenario 1: Basic Web Application Routing

For a basic web application deployment, you may only need to route requests to the default virtual host:

<Engine name="Catalina" defaultHost="localhost">
  <Realm className="" />
  <Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true">
    <!-- Can contain specific<Context>Element Definition -->
  </Host>
</Engine>
  • name: The name of the engine, usually the same as<Service>element's name matches.
  • defaultHost: The request could not be matched to any<Host>The default hostname to be used when

Scenario 2: Deploying multiple web hosts

If you need to deploy multiple virtual hosts on the same server, you can deploy them on the same<Engine>Configure multiple<Host>

<Engine name="Catalina" defaultHost="default">
  <Host name="" appBase="webapps/app1" unpackWARs="true" autoDeploy="true">
    <!-- appliance1specifications -->
  </Host>
  <Host name="" appBase="webapps/app2" unpackWARs="true" autoDeploy="true">
    <!-- appliance2specifications -->
  </Host>
</Engine>

Scenario 3: Cluster Deployment

In cluster deployment scenarios that require high availability, you can configure the cluster manager to synchronize session information:

<Engine name="Catalina" defaultHost="localhost" jvmRoute="node1">
  <Cluster className="">
    <Channel className="">
      <Member className=""
              host="node2"
              port="4000" />
    </Channel>
  </Cluster>
  <Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true">
    <!-- Host Configuration -->
  </Host>
</Engine>
  • jvmRoute: The JVM routing identifier for the current instance, used for session lookup in the cluster.

Scenario 4: Customized request filters

If you need to apply custom filters to all requests, you can do so in the<Engine>lower configuration<Valve>

<Engine name="Catalina" defaultHost="localhost">
  <Valve className="" />
  <Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true">
    <!-- Host Configuration -->
  </Host>
</Engine>
  • className: Specifies the full class name of the custom filter.

Scenario 5: Access Log Configuration

In order to keep an access log of all requests, the<Engine>Configure the access logging valve under:

<Engine name="Catalina" defaultHost="localhost">
  <Realm className="" />
  <Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true">
    <!-- Host Configuration -->
  </Host>
  <Valve className="" directory="logs"
         prefix="access_log." suffix=".txt" pattern="common" rotate="true" />
</Engine>
  • directory: Access the directory where the log files are stored.
  • prefixcap (a poem)suffix: Prefix and suffix of the log file.
  • pattern: The format of the log record.
  • rotate: Whether log rotation is enabled.

5. <Host>

<Host>element in Tomcat'sThe configuration file is configured with a virtual host that handles requests directed to a specific hostname or IP address. The following business scenarios are based on the<Host>Configuration example:

Scenario 1: Virtual hosting for a single application

For a single application deployment, you can configure a virtual host to which all requests are mapped:

< Host name="" appBase="webapps" unpackWARs="true" autoDeploy="true">!
  <! -- The application's Context configuration can be added here, or configured in a separate XML file -->
</Host>
  • name: The name of the virtual host, usually the domain name of the application.

Scenario 2: Virtual Hosting for Multiple Applications

If you wish to manage multiple applications on a single virtual host, you can do so in the<Host>Configure multiple<Context>

<Host name="" appBase="webapps" unpackWARs="true" autoDeploy="true">
  <Context path="/app1" docBase="app1" />
  <Context path="/app2" docBase="app2" />
  <!-- more appliedContextconfigure -->
</Host>
  • path: The path to the Web application.
  • docBase: The document base path or WAR filename for the Web application.

Scenario 3: Using an externally defined Context

In complex deployment scenarios, you may want to combine the<Context>configured in an external XML file to keep theof clarity:

<Host name="" appBase="webapps" unpackWARs="true" autoDeploy="true">
  <Context path="" docBase="external" reloadable="true" />
  <!-- (sth. or sb) elseContextconfigure -->
</Host>
  • <Context>(used form a nominal expression)pathCan be left blank to indicate the root path of the application.
  • docBaseYou can point to a file containing theThe directory of the file.

Scenario 4: Configuring aliases

If you want your web host to respond to multiple domain names, you can use the<Alias>Elements:

<Host name="" appBase="webapps" unpackWARs="true" autoDeploy="true">
  <Alias></Alias>
  <!-- appliedContextconfigure -->
</Host>
  • <Alias>: Another domain name for the web host.

Scenario 5: Configuring SSL

For virtual hosts that require SSL encryption, you can configure an SSL connector with the<Host>Specify SSL-related attributes in the

<Host name="" appBase="webapps" unpackWARs="true" autoDeploy="true"
      sslProtocol="TLS" sslCertificateFile="/path/to/"
      sslCertificateKeyFile="/path/to/" sslPort="8443">
  <!-- appliedContextconfigure -->
</Host>
  • sslProtocol: The SSL protocol used.
  • sslCertificateFilecap (a poem)sslCertificateKeyFile: Path to the SSL certificate and private key files.
  • sslPort: SSL port, SSL will be used when clients access through this port.

Scenario 6: Disabling certain HTTP methods

For security reasons, you may wish to disable certain HTTP methods:

<Host name="" appBase="webapps" unpackWARs="true" autoDeploy="true">
  <Valve className="" 
         pattern="%h %l %u %t &quot;%r&quot; %s %b" />
  <Context>
    <Valve className="" methods="TRACE" />
  </Context>
</Host>
  • methods: A list of HTTP methods to be disabled.

6. <Context>

<Context>element in Tomcat'sThe context of the web application is defined in the configuration file. Each<Context>Represents a web application, including its path, document base, session management, and other application-specific settings. The following are based on different business scenarios<Context>Configuration example:

Scenario 1: Basic Web Application Deployment

For a basic web application deployment, you need to specify the path and document base of the application:

<Context path="/myapp" docBase="myapp" />
  • path: The URL path of the web application.
  • docBase: The name of the directory or WAR file for the Web application.

Scenario 2: Configuring an external WAR file

If you have an external WAR file that you wish to deploy to a specific context path:

<Context path="/externalapp" docBase="/path/to/" />
  • docBase: Absolute path to an external WAR file.

Scenario 3: WAR files using relative paths

In some cases, you may want to use a different name relative to theappBaseThe relative path of the

<Context path="/relapp" docBase="webapps/" />

Scenario 4: Configuring Session Timeout

To manage the session lifecycle, you can set the session timeout time (in minutes):

<Context path="/myapp" docBase="myapp" sessionTimeout="30" />

Scenario 5: Enabling application reloading

During development, you may want to automatically reload the application after code changes:

<Context path="/devapp" docBase="devapp" reloadable="true" />
  • reloadable: Set totrueto enable automatic reloading of the application.

Scenario 6: Configuring Resource Links

If your application needs to connect to an external resource (such as a database), you can configure resource links:

<Context path="/myapp" docBase="myapp">
  <ResourceLink global="jdbc/myDB" type=""
                name="jdbc/myAppDB" />
</Context>
  • ResourceLink: Defines a resource link that allows an application to access a resource that is defined in the<GlobalNamingResources>The resources defined in the

Scenario 7: Configuring Security Settings

For applications that require security authentication, you can configure security constraints and roles:

<Context path="/secapp" docBase="secapp">
  <SecurityConstraint>
    <WebResourceCollection urlPattern="/*">
      <HttpMethod constraint="POST,PUT" />
    </WebResourceCollection>
    <AuthConstraint>
      < Role name="admin" />
    </AuthConstraint>
  </SecurityConstraint>
  <Valve className="" />
</Context>
  • SecurityConstraint: Defines which resources need to be secured.
  • WebResourceCollection: Defines protected URL patterns and HTTP methods.
  • AuthConstraint: Defines the roles that are allowed access.
  • Valve: Specifies the type of authentication (for example, basic authentication).

Scenario 8: Configuring Character Sets and Localization

To ensure that the application handles internationalized content correctly, you can configure the character set and localization:

<Context path="/globalapp" docBase="globalapp" useHttpOnly="true">
  <LocaleConfig defaultLocale="en" />
  <CharsetConfig>
    <Charset name="UTF-8" />
  </CharsetConfig>
</Context>
  • useHttpOnly: Set totrueto enable HttpOnly Cookies.
  • LocaleConfig: Defines the default locale settings.
  • CharsetConfig: Defines the character set used by the application.

7. <Listener>

<Listener>element in Tomcat'sThe configuration file is used to register event listeners that are called when Tomcat's lifecycle events (such as start and stop) occur. The following are based on different business scenarios<Listener>Configuration example:

Scenario 1: Custom Context Initialization

If you need to execute custom logic when Tomcat starts, such as initializing a database connection pool or loading application-specific resources, you can define a custom context listener:

<Listener className="" />
  • className: Specifies the full class name of the custom listener.

Scenario 2: SSL Certificate Management

In business scenarios where SSL certificates need to be loaded or refreshed dynamically, a customized certificate management listener can be used:

<Listener className="" />

Scenario 3: Cluster Session Management

When Tomcat is configured in cluster mode, you can use specific listeners to manage session replication:

<Listener className="" />
  • This listener is part of the Tomcat cluster session management and is used to set up JVM routing.

Scenario 4: Request Logging

To log all requests into Tomcat, you can configure a request log listener:

<Listener className="" />
<Listener className="" />
<Listener className="" />
<Listener className="" />
<Listener className="" />
<Listener className="" directory="logs" prefix="access_log" suffix=".txt" pattern="common" resolveHosts="false" />
  • AccessLogValve: A listener used to record access logs. You can set the directory, prefix, suffix, and logging mode of the logs.

Scenario 5: Performance Monitoring

In order to monitor the performance of Tomcat, you can add performance monitoring listeners:

<Listener className="" />

Scenario 6: Tomcat Resource Management

Tomcat's resource management listeners can be used to track and manage JNDI resources:

<Listener className="" />

Scenario 7: Customized User Data Management

If you need to load or save user data when Tomcat starts or stops, you can define a custom user data management listener:

<Listener className="" />

Scenario 8: Tomcat Security Listener

Tomcat provides a number of built-in security listeners for security-related initialization and cleanup at startup and stop:

<Listener className="" />

8. <Realm>

<Realm>element in Tomcat'sThe configuration file defines the security domain, which handles user authentication and authorization. The following business scenarios are based on the<Realm>Configuration example:

Scenario 1: Using in-memory authentication

In a development environment, you may want to use an in-memory list of users and roles for authentication:

<Realm className="" />

Scenario 2: Using JDBC database authentication

For production environments, you may need to use a database to store user information and role information:

<Realm className=""
        driverName=""
        connectionURL="jdbc:mysql://localhost:3306/tomcatdb"
        dataSourceName="java:comp/env/jdbc/tomcatDataSource"
        userTable="users" userCredColumn="password" userNameColumn="username" />
  • driverName: The class name of the JDBC driver.
  • connectionURL: Database connection URL.
  • dataSourceName: JNDI resource name for finding the data source.
  • userTable: A database table that stores user information.
  • userCredColumn: The column where the password is stored.
  • userNameColumn: Column that stores the user name.

Scenario 3: Using JAAS Certification

If your application requires the use of Java Authentication and Authorization Service (JAAS), you can configure JAAS authentication:

<Realm className=""
        appName="myApp" />
  • appName: The name of the JAAS application.

Scenario 4: Using LDAP Authentication

LDAP authentication can be used when user information is stored on an LDAP server:

<Realm className=""
        userPattern="uid={0},ou=people,dc=example,dc=com"
        connectionName="uid=admin,ou=people,dc=example,dc=com"
        connectionPassword="adminpassword"
        url="ldap://:389/" />
  • userPattern: The search pattern for user information in LDAP.
  • connectionName: User name for connecting to the LDAP server.
  • connectionPassword: The password for connecting to the LDAP server.
  • url: The URL of the LDAP server.

Scenario 5: Using Custom Realm

If you have special authentication needs, you can create custom Realm implementations:

<Realm className="" />

Scenario 6: Combining Multiple Realm Uses

In some business scenarios, you may need to combine multiple Realms for authentication, for example, trying to use in-memory authentication first, and if that fails then trying to use database authentication:

<Realm className="">
    <Realm className="" />
    <Realm className=""
           driverName="..."
           connectionURL="..."
           userTable="..."
           userCredColumn="..."
           userNameColumn="..." />
</Realm>
  • CombinedRealm: Combine multiple Realm authenticators.

Scenario 7: Using Container-Managed Realm

If you are using Tomcat in an application server such as GlassFish or JBoss, you may need to use container-managed Realm:

<Realm className=""
        ignoreEmptyPassword="true" />
  • ignoreEmptyPassword: Whether to ignore empty passwords.

9. <Valve>

<Valve>element in Tomcat'sThe configuration file is used to insert custom processing logic that can be executed at different stages of the request processing pipeline. The following is based on different business scenarios<Valve>Configuration example:

Scenario 1: Access logging

Record detailed log messages for each request, which is useful for analyzing traffic and debugging applications:

<Valve className="" 
       pattern="%h %l %u %t &quot;%r&quot; %s %b" />
  • pattern: Defines the format of the log.%h, %l, %u, %t, %r, %s, %b represent the host name, login name, user ID, time, request line, status code, and number of bytes, respectively.

Scenario 2: Request Response Time Logging

Monitor the response time of each request to evaluate application performance:

<Valve className="" />

Scenario 3: Request Filtering

Filter specific requests, such as disabling or restricting certain HTTP methods:

<Valve className="" methods="TRACE" />
  • methods: Specifies a list of HTTP methods to be disabled.

Scenario 4: Static Resource Caching

Set cache headers for static resources to improve responsiveness and reduce server load:

<Valve className="" 
       cache="maxSize=100000,ttl=3600" />
  • cache: Defines the size and duration (TTL) of the cache.

Scenario 5: SSL Authentication

Enforces the use of SSL connections for all requests, enhancing application security:

<Valve className="" keystoreFile="/path/to/" keystorePass="password" />
  • keystoreFile: The path to the keystore file.
  • keystorePass: The password for the keystore.

Scenario 6: Request Rewrite

Rewrite request URIs according to specific rules for URL redirection or rewriting:

<Valve className="" />

Scenario 7: Customized Request Processing

Performs customized request processing logic, such as pre-processing or post-processing of user requests:

<Valve className="" />

Scenario 8: Session Management

Customize session management logic, such as session timeout handling or session persistence:

<Valve className="" />

Scenario 9: Error Page Customization

Customize the error page response, e.g. define different error pages for different HTTP status codes:

<Valve className="" 
       showReport="false" showServerInfo="false" />
  • showReport: Whether to display a detailed error report.
  • showServerInfo: Whether to display server information.

ultimate

The above are important configuration items in the file, in the project application, the configuration of different scenarios are different, the above for your reference, if you are willing to share your configuration scenarios in the project case, welcome to the comments section, the volume of the times, brothers together to help move forward.