2017-01-24 4 views
0

HTTP(ポート8080)とHTTPS(ポート8443)の両方をサポートするようにTomcatを設定しています。私はこのように設定している場合server.xmlで、:リダイレクトなしでTomcatでHTTPとHTTPSの両方を有効にする方法はありますか?

<Connector port="8080" protocol="HTTP/1.1" 
      connectionTimeout="20000" 
      URIEncoding="UTF-8" 
      redirectPort="8443" /> 

    <Connector port="8443" protocol="HTTP/1.1" 
      SSLEnabled="true" 
      scheme="https" 
      secure="true" 
      Server="" 
      keystoreFile="conf/.keystore" 
      keystorePass="password" 
      maxThreads="150" 
      maxSpareThreads="75" 
      minSpareThreads="25" 
      clientAuth="false" sslProtocol="TLS" 
      URIEncoding="UTF-8" 
      /> 

http://SERVER_IP:8080へのすべてのアクセスをhttps://SERVER_IP:8443に送られます。リダイレクトを無効にして、httpとhttpsの両方にアクセスできるようにするにはどうすればよいですか?

redirectPort="8443"を削除しようとしましたが、機能しません。 @pedrofbの助けを借りて

+0

この設定は正しいです。 'web.xml'ファイルの' security-constraint'要素を投稿できますか? 'HTTPSOnly'があれば削除してください – pedrofb

+0

コメントありがとうございます! web.xmlファイルから ' CONFIDENTIAL'を削除しました。これでHTTPとHTTPSの両方のアクセスが可能になりました! – Starry

答えて

1

は、私は解決策を考え出した:ようserver.xmlファイル、編集web.xmlファイルを変更するほか:

<security-constraint> 
    <web-resource-collection> 
    <web-resource-name>Support Both HTTP and HTTPS 
    </web-resource-name> 
    <url-pattern>/*</url-pattern> 
    </web-resource-collection> 
    <user-data-constraint> 
     <!-- <transport-guarantee>CONFIDENTIAL</transport-guarantee> --> 
    </user-data-constraint> 
</security-constraint> 

<transport-guarantee>CONFIDENTIAL</transport-guarantee>がコメントし、またはそうでなければHTTPSのみを許可していることを確認しますアクセス。

関連する問題