Bỏ qua điều hướng
← Về danh sách bài viết
Hướng dẫn kỹ thuật

Hướng dẫn cấu hình Tomcat chạy HTTP và HTTPS

Để cấu hình tomcat chạy chuyển hướng hoặc chạy song song http và https Quý khách có thể thay đổi trong 2 file web.xml và server.xml.

BKNS

Hướng dẫn cấu hình Tomcat chạy song song 2 port HTTP và HTTPS

Để cấu hình tomcat chạy chuyển hướng hoặc chạy song song http và https Quý khách có thể thay đổi trong 2 file web.xml và server.xml. Dưới đây là config để chạy song song

Cấu hình file: server.xml

text
<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"
           />

Cấu hình file: web.xml

text
<security-constraint>
<web-resource-collection>
<!-- <web-resource-name>HTTPSOnly</web-resource-name> -->
<url-pattern>/*</url-pattern>
</web-resource-collection>
<user-data-constraint>
<!-- <transport-guarantee>CONFIDENTIAL</transport-guarantee> -->
</user-data-constraint>
</security-constraint>

file này đã được chú thích 2 dòng chuyển hướng “<web-resource-name>HTTPSOnly</web-resource-name>” và <!-- <transport-guarantee>CONFIDENTIAL</transport-guarantee> -->

Trong trường hợp cần chuyển hướng http sang https quý khách có thể bỏ chú thích 2 dòng này