Giter Club home page Giter Club logo

ssl-apachetomcat's Introduction

SSL-ApacheTomcat

Some applications don't work correctly with security-constraint and have to force push Http to Https requests This include simply bit different way to complete Http to Https Issue

Generate your SSL Cetificates

Copy these files in to secured path in the server

Edit your server.xml File

Located in apache-tomcat > conf > server.xml

<Connector URIEncoding="UTF-8" port="80" acceptCount="100" enableLookups="false" maxThreads="150" redirectPort="443" />

<Connector port="443" protocol="org.apache.coyote.http11.Http11NioProtocol"
               maxThreads="150" SSLEnabled="true">
        <UpgradeProtocol className="org.apache.coyote.http2.Http2Protocol" />
        <SSLHostConfig>
            <Certificate certificateKeyFile="/usr/local/xxx/xxx.key"
                         certificateFile="/usr/local/xxx/xxx.crt"
                         certificateChainFile="/usr/local/xxx/xxx.crt"
                         type="RSA" />
        </SSLHostConfig>
</Connector>

Add the following element into <Host name="localhost" ...> at last

<Valve className="org.apache.catalina.valves.rewrite.RewriteValve" />

Edit you web.xml File

Located in apache-tomcat > conf > web.xml

To force Tomcat to redirect and revert all requested HTTP traffic over to HTTPS, configure the conf/web.xml file with the below block. This should be placed at the very end of the file near and above the ending </webapp> tag:

<security-constraint>
   <web-resource-collection>
   <web-resource-name>Protected Context</web-resource-name>
        <url-pattern>/*</url-pattern>
        <!--<url-pattern>/adportal/*</url-pattern>-->
   </web-resource-collection>
   <user-data-constraint>
   <transport-guarantee>CONFIDENTIAL</transport-guarantee>
   </user-data-constraint>
</security-constraint>

======Try restarting Apache-tomcat server========

Some applications don't work correctly with that security-constraint, so I followed a completely different approach:(It's Working on apache-tomcat 9)

Create the file conf/Catalina/localhost/rewrite.config

Sample is attached with this

======Try restarting Apache-tomcat server again It should work ======

===================GOOD LUCK=================

ssl-apachetomcat's People

Contributors

pasanmudalige avatar pasanminsharp avatar

Stargazers

Sanjeevan M avatar Ganeesha Edirisinghe avatar  avatar Diliru Nagahawatta avatar  avatar Dileepa Nipun Salinda avatar Nethma Thathsarani avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.