SSL for specific pages / url templates in tomcat

I recently configured tomcat 6 with SSL and client authentication, but the only way I could do this was to change the server configuration files (web.xml, server.xml). But since I do not have full control over the deployment server, I would like to configure everything only for some pages or url-templates of my application without changing the main configuration files.

For example: Main server:

  • Application1 -> HTTP
  • Application2 -> HTTP
  • MyApplication → HTTPS

If anyone knows how to do this, tell me.

+3
source share
2 answers

https - server.xml <service>. http https. , . http https :

<Connector port="80" protocol="HTTP/1.1"
           maxThreads="150" connectionTimeout="20000"
           redirectPort="443"
           URIEncoding="UTF-8" compression="on"/>

<Connector port="443" protocol="HTTP/1.1"
           maxThreads="150" connectionTimeout="20000"
           SSLEnabled="true" scheme="https" secure="true"
           keystoreFile="conf/.keystore"
           keystorePass="changeit"
           clientAuth="false" sslProtocol="TLS"
           URIEncoding="UTF-8" compression="on"/>

https, transport-guarantee web.xml, - :

<security-constraint>
    <web-resource-collection>
        <web-resource-name>Administrators</web-resource-name>
        <url-pattern>/*</url-pattern>
    </web-resource-collection>
    <auth-constraint>
        <role-name>Administrators</role-name>
    </auth-constraint>
    <user-data-constraint>
        <transport-guarantee>CONFIDENTIAL</transport-guarantee>
    </user-data-constraint>
</security-constraint>

transport-guarantee -, . , , .

, server.xml, https . https-.

+8

@rmarimon, server.xml, Filter, URL- http/https .

- <filter-mapping> web.xml

-1

Source: https://habr.com/ru/post/1776985/


All Articles