Deploying multiple WEB applications on the same server, the solution to the SESSION conflict

  Because Tomcat is used to deploy multiple WEB projects on one server, and the projects use the same framework, they run at the same time, and the sessions conflict with each other. as follows:

In the server.xml file, under the host tab, add the Context tag, and the content of the tag can be written as follows:

<Context path=”” docBase=”” sessionCookieName=”myprojectname”></Context>

Some explanations for the above properties:

The path attribute refers to the name of the project. If it is to directly access the URL, fill in the blank here;

The docBase attribute refers to the name of the project, which can be customized or empty, which indicates that it is ROOT under webapps;

The sessionCookieName attribute is what needs to be paid attention to here. It specifies the unique identifier of the session of the current project, and each name is customized in order not to conflict with other projects.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325250097&siteId=291194637