我们希望将Web应用程序从http迁移到https。 这本身很简单。但是,我们有一个问题。
我们部署了三个上下文:main.war,reporting.war和generator.war
由于我们的应用程序中存在一些遗留代码,对生成器的访问必须保留http,而main和report仅允许使用https。
我尝试通过在服务器上添加一个附加的“服务”来修改server.xml,并在http服务中使用https和“ generator”将contex的内容“ main”和“ reporting”放入其中。
问题在于所有上下文现在都接受http和https,而我不知道为什么。
您能帮助我理解和解决此问题吗? 谢谢!
<?xml version='1.0' encoding='utf-8'?>
<Server port="8005" shutdown="SHUTDOWN">
<Listener className="org.apache.catalina.startup.VersionLoggerListener" />
<Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
<Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
<Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />
<GlobalNamingResources>
<Resource name="UserDatabase" auth="Container"
type="org.apache.catalina.UserDatabase"
description="User database that can be updated and saved"
factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
pathname="conf/tomcat-users.xml" />
</GlobalNamingResources>
<Service name="Catalina">
<Connector
protocol="org.apache.coyote.http11.Http11NioProtocol"
port="443" maxThreads="200"
scheme="https" secure="true" SSLEnabled="true"
keystoreFile="file:///C:/tomcat/testkey.keyfile" keystorePass="testpassword"
clientAuth="false" sslProtocol="TLS"/>
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
<Engine name="Catalina" defaultHost="localhost">
<Realm className="org.apache.catalina.realm.LockOutRealm">
<Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/>
</Realm>
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true">
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="localhost_access_log" suffix=".txt"
pattern="%h %l %u %t "%r" %s %b" />
<Context docBase="main" path="/main" reloadable="true" source="main"/>
<Context docBase="reporting" path="/reporting" reloadable="true" source="reporting"/>
</Host>
</Engine>
</Service>
<Service name="CatalinaGenerator">
<Connector executor="tomcatThreadPool"
port="80" protocol="HTTP/1.1"
connectionTimeout="20000" />
<Connector URIEncoding="UTF-8" port="8009" protocol="AJP/1.3" redirectPort="8443"/>
<Engine defaultHost="localhost" name="Catalina">
<Realm className="org.apache.catalina.realm.LockOutRealm">
<Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/>
</Realm>
<Host appBase="webapps" autoDeploy="true" name="localhost" unpackWARs="true">
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" pattern="%h %l %u %t "%r" %s %b" prefix="localhost_access_log" suffix=".txt"/>
<Context docBase="generator" path="/generator" reloadable="true" source="generator"/>
</Host>
</Engine>
</Service>
</Server>
答案 0 :(得分:0)
对于这种设置,我个人在雄猫前面添加了一个Apache http并使用mod_proxy处理此类事情。