Updated on 2024-08-05 GMT+08:00

How Do I Customize a Tomcat Context Path?

When creating and deploying a Tomcat application, Tomcat configurations are required. Specifically, the default server.xml configuration is used, the context path is /, and no application path is specified.

  • If Public Network Access is enabled, the application access address is http://${Public domain name of the application}:${Application access port}, for example, http://example_domain.com:30317.
  • If Public Network Access is not enabled, the application access address is http://${Intranet access address of the VPC}:${Application access port}, for example, http://192.168.0.168:30317.

During the component configuration for component deployment, you can customize the application path based on the actual service when configuring Tomcat parameters.

  1. Select Parameter settings.
  2. Click Use Sample Code and edit the template file based on service requirements.
  3. Modify the value of Context path by referring to the following example. For example, after you change the value to app-path, the application access address is changed to http://example_domain.com:30317/app-path or http://192.168.0.168:30317/app-path.
    <Host name="localhost"  appBase="webapps" 
          unpackWARs="true" autoDeploy="true" >
       <Context path="app-path" docBase="ROOT.war"/>