Project sessions with two different ports under one domain name cannot exist at the same time

Since the login information of the two projects is stored in the session, when I log in to one project and then log in to the other, the previous session will be emptied and covered.

Finally, I found information on the Internet and learned that adding a sessionCookieName attribute to the <Context> tag in the <Host> tag of Tomcat would be enough. Of course, the sessionCookieName of the two projects should be different.

The following is the configuration in the <Service> tag in my server.xml:

<Service name="Catalina">
  
		<Connector connectionTimeout="20000" port="8081" protocol="HTTP/1.1" redirectPort="8443" URIEncoding="UTF-8"/>
		
		<Connector port="8009" protocol="AJP/1.3" redirectPort="8443"/>

		<Engine defaultHost="localhost" name="Catalina">

		<Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/>

		<Host appBase="webapps" autoDeploy="true" name="localhost" unpackWARs="true" xmlNamespaceAware="false" xmlValidation="false">

		<Context path="" docBase="Test1" reloadable="true" sessionCookieName="Test1"/>
      </Host>
    </Engine>
  </Service>

Information address: http://blog.csdn.net/mangmang2012/article/details/11968439


Guess you like

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