TOMCATでのSSLについて
コマンドプロンプトで
keytool -genkey -alias tomcat -keyalg RSA
Enter keystore password: changeit
keytool -certreq -alias tomcat -file server.csr
https://localhost:8443
でアクセス可能
特定のページに対して、httpsを強制する方法
「web.xml」の「security-constraint」を設定する。
※「transport-guarantee」では、SSLを使用したい場合には、「CONFIDENTIAL」を指定する。
HTTPでアクセスすると、自動的にHTTPSでアクセスされるようにリダイレクトされる。
keytool -genkey -alias tomcat -keyalg RSA
Enter keystore password: changeit
keytool -certreq -alias tomcat -file server.csr
<-- Define an SSL HTTP/1.1 Connector on port 8443 --> <!-- <Connector className="org.apache.catalina.connector.http.HttpConnector" port="8443" minProcessors="5" maxProcessors="75" enableLookups="true" acceptCount="10" debug="0" scheme="https" secure="true"> <Factory className="org.apache.catalina.net.SSLServerSocketFactory" clientAuth="false" protocol="TLS"/> </Connector> -->のコメントを外す
https://localhost:8443
でアクセス可能
特定のページに対して、httpsを強制する方法
「web.xml」の「security-constraint」を設定する。
<security-constraint> <web-resource-collection> <url-pattern>/securepage/*</url-pattern> <http-method>GET</http-method> <http-method>POST</http-method> </web-resource-collection> <user-data-constraint> <transport-guarantee>CONFIDENTIAL<transport-guarantee> </user-data-constraint> </security-constraint>
※「transport-guarantee」では、SSLを使用したい場合には、「CONFIDENTIAL」を指定する。
HTTPでアクセスすると、自動的にHTTPSでアクセスされるようにリダイレクトされる。
2006年07月07日(金) 23:20:40 Modified by amatsubame