Understanding Apache Tomcat File Configurations
Apache Tomcat is a widely used, open-source Java web application server that provides a robust environment for running Java-based applications. Innoslate utilizes Apache Tomcat to enhance its functionality, allowing users to deploy and manage our web application with ease. Tomcat serves as the backbone for Innoslate's server-side operations, enabling features such as dynamic content generation, session management, and integration with the database. Its architecture supports the Java Servlet and JavaServer Pages (JSP) specifications, which are essential for building scalable and maintainable web applications. By leveraging Apache Tomcat, Innoslate ensures high performance, reliability, and flexibility in delivering its services to users.
Below we highlight frequently asked configurations within the Apache Tomcat files, providing essential guidance to help users customize their Tomcat server settings according to their specific application requirements. These configurations are crucial for optimizing performance, enhancing security, and ensuring seamless integration with other services. By understanding and applying these settings, users can tailor their Tomcat environment to better suit their operational needs, ultimately improving the overall functionality of their web applications. Whether you're adjusting the port for your application, setting session timeouts, or configuring reverse proxy settings, the following sections will provide clear instructions and best practices to facilitate these important modifications.
Note, after applying any of the below settings, you MUST restart the Apache Tomcat Server. This may be done with the Startup and Shutdown Scripts in the bin file located at: C:\Innoslate4\apache-tomcat\bin
Configuring Browser Port
To change the 8080 port Innoslate deafults to, you'll need to access the following XML file in the Innoslate files: C:\Innoslate4\apache-tomcat\conf\server.xml and update the following to change to the port to what you want.
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
Note, after applying the above settings, you MUST restart the Apache Tomcat Server. This may be done with the Startup and Shutdown Scripts in the bin file located at: C:\Innoslate4\apache-tomcat\bin
Configuring User Timeout Settings
To configure session timeout settings, you will need to navigate to your “web.xml” file, found within the Innoslate4 folder at the following directory: “Innoslate4\apache-tomcat-8.5.30\webapps\innoslate4\WEB-INF”.
You will need to modify the following field:
<session-config>
<session-timeout>30</session-timeout>
</session-config>
Modify “30” to the number of minutes you want session to stay active.
Note, after applying the above settings, you MUST restart the Apache Tomcat Server. This may be done with the Startup and Shutdown Scripts in the bin file located at: C:\Innoslate4\apache-tomcat\bin
Setting up Tomcat with a Reverse Proxy
Apache Tomcat does not necessarily require an Origin header to function properly. However, if an Origin header is included in your requests, it is important that it matches the host name of your Tomcat server.
For example, a call from api.example.com
with an Origin
header set to 'api.example.com' (in case of browser) will not work since <Host name="localhost">
is the default value.
The host name in the file server.xml (can be found at C:\Innoslate4\apache-tomcat\conf\server.xml ) will need to be configured to match the domain name used in the virtual host of apache server. To configure this, you'll need to change the name="localhost"
to name=api.example.com
:
<Host name="api.example.com" appBase="webapps"
unpackWARs="true" autoDeploy="true" deployXML="true">
Also update the connector tag in the server.xml:
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443"
scheme="https" secure="true" proxyName="api.example.com" proxyPort="443" />
The following attributes inform tomcat, it is being accessed via a reverse proxy with ssl.
scheme="https" secure="true" proxyName="api.example.com" proxyPort="443"
If you do not perform the above step of adding proxy to Connector
tag, every POST request will throw a 403 error.
Note, after applying the above settings, you MUST restart the Apache Tomcat Server. This may be done with the Startup and Shutdown Scripts in the bin file located at: C:\Innoslate4\apache-tomcat\bin