2016-06-25 1 views
0

私は一般的にhttpsで動作するアプリケーションを持っています。 Tomcatはポート8443でリッスン:単一のTomcatインスタンスにhttpsとhttpを混ぜてください

<Connector port="8080" protocol="HTTP/1.1" 
       connectionTimeout="20000" 
       redirectPort="8443" /> 
<Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol" 
      maxThreads="150" SSLEnabled="true" scheme="https" secure="true" 
      clientAuth="false" sslProtocol="TLS" 
      keyAlias="MY_ALLIAS" keystoreFile="PATH_TO_MY_KEY" 
      keystorePass="MY_PASWORD" /> 

Apacheが80でリッスンし、8443にリダイレクト:

がweb.xmlの最後に
<VirtualHost *:80> 
     ServerAdmin MY_EMAIL_ADDRESS 
     ServerName localhost 
     ServerAlias localhost 
     ProxyPass/http://localhost:8443/ 
     ProxyPassReverse/http://localhost:8443/ 
     DocumentRoot /var/www/html 

私が追加:

<security-constraint> 
    <web-resource-collection> 
     <web-resource-name>MY_WEB_RESOURCE_NAME</web-resource-name> 
     <url-pattern>/welcome</url-pattern> 
    </web-resource-collection> 
    <user-data-constraint> 
     <transport-guarantee>CONFIDENTIAL</transport-guarantee> 
    </user-data-constraint> 
</security-constraint> 

を残念ながら、私は追加する必要があります私のウェブサイトの1つにhttpサイトを持つIFRAME。セキュリティは問題ではありません。私の問題はTomcatの設定です。私はApacheにトラフィックを送り出すと思います。しかし今私の質問は、Tomcatをセットアップする方法です。私はサイトhttp://localhost:8080/siteAを提供することができ、他のすべてのサイトはhttps://localhost:8443/myOtherSitesに配信されますか?私はredirectPort = "8443"を削除しようとしましたが、十分ではありません。私はTomcat 9.0.0.M4を使用しています(Tomcat 8に移動するのは問題ありません)。 助けてください!あなたがNONEとしてトランスポート保証を設定しているので、その保護されたリソースまたはそうでなければ、Tomcatは検証しません。この `

<security-constraint> 
<web-resource-collection> 
<web-resource-name>Unsecured resources</web-resource-name> 
<url-pattern>/siteA</url-pattern> 
</web-resource-collection> 
<user-data-constraint> 
<transport-guarantee>NONE</transport-guarantee> 
</user-data-constraint> 
</security-constraint> ` 

ようなあなたのweb.xmlに1個の以上<security-constraint>タグを追加し、この問題を解決するために

答えて

0

。このようにこの<security-constraint>は、httpであなたのsiteAにアクセスし、httpsであなたの他のサイトにアクセスするのに役立つと既に宣言した他の<security-constraint>タグにアクセスするのに役立ちます。 <url-pattern>タグhttpまたはhttpsとして保存したいページへのパスを指定します。これで問題が解決するかどうか教えてください:)。

+0

ようこそ、よろしくお願いします:) –

関連する問題