简体   繁体   中英

Tomcat ssl port not redirected automatically

  1. i enabled both non-ssl(8440) connector and ssl(8445) connector in server.xml, when ever i started the server it redirects me to " http://localhost:8445/ " but i given this port in ssl connector.

  2. When i am trying to access http://localhost:8440 , it allows me to enter application ( it must redirect to the ssl port as i given redirect port)

  3. every thing working fine , if i removed non-ssl connector.

tomcat version : tomcat 5.0.28 -thanks in advance

My server.xml entries

    <Connector port="8440" maxHttpHeaderSize="8192"
       maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
       enableLookups="false" redirectPort="8445" acceptCount="100"
       connectionTimeout="20000" disableUploadTimeout="true" />


<Connector SSLEnabled="true" acceptCount="100" clientAuth="false" 
      connectionTimeout="20000" debug="0" disableUploadTimeout="true" 
      emptySessionPath="true" enableLookups="false"  maxThreads="150" 
      minSpareThreads="25" name="SSL" port="8445" scheme="https" 
      secure="true" sslProtocol="TLS"/>

server.xml file

<!-- Test entry for demonstration purposes -->

<Environment name="simpleValue" type="java.lang.Integer" value="30"/>



<!-- Editable user database that can also be used by
     UserDatabaseRealm to authenticate users -->

<Resource auth="Container" description="User database that can be updated and saved" name="UserDatabase" type="org.apache.catalina.UserDatabase">

</Resource>

<ResourceParams name="UserDatabase">

  <parameter>

    <name>factory</name>

    <value>org.apache.catalina.users.MemoryUserDatabaseFactory</value>

  </parameter>

  <parameter>

    <name>pathname</name>

    <value>conf/tomcat-users.xml</value>

  </parameter>

</ResourceParams>

<Connector acceptCount="100" connectionTimeout="20000" debug="3" disableUploadTimeout="true" enableLookups="false" maxSpareThreads="75" maxThreads="150" minSpareThreads="25" name="WebServer" port="8440" redirectPort="8445"/>
<Engine debug="0" defaultHost="localhost" name="Catalina">
<Realm allRolesMode="strictAuthOnly" appName="myapp" className="com.authentication.CustomJAASRealm" roleClassNames="com.authentication.RolePrincipal" userClassNames="com.authentication.UserPrincipal">

</Realm>

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

    <Valve className="org.apache.catalina.authenticator.SingleSignOn" debug="0"/>
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" pattern="%u %U %S &quot;%{Referer}i&quot; %a %A %m %t %D %b %s &quot;%{User-Agent}i&quot;" prefix="access_log." resolveHosts="false" rotatable="false" suffix="txt"/>


         <Logger className="org.apache.catalina.logger.FileLogger" directory="logs" prefix="localhost_log." suffix=".txt" timestamp="true"/>


<Context debug="0" docBase="${home}/webapps" path=""/>

<Context appBase="webapps" debug="0" docBase="${home}/help/" path="/help" reloadable="true"/>     



</Host>



</Engine>

Please always read the documentation that help you to learn. You can check it HERE .

Go to your $TOMCAT_HOME/conf/server.xml and change redirect port:

<Connector port="8080"
  enableLookups="false"
  redirectPort="8440" />

<Connector port="8440" protocol="HTTP/
  enableLookups="false"
  redirectPort="8445" />

Cheers!!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM