<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	
	xmlns:georss="http://www.georss.org/georss"
	xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"
	>

<channel>
	<title>Tomcat &#8211; Jiří Kratochvíl</title>
	<atom:link href="https://jiri.kratochvil.eu/tag/tomcat/feed/" rel="self" type="application/rss+xml" />
	<link>https://jiri.kratochvil.eu</link>
	<description>Kráťovo občasník</description>
	<lastBuildDate>Mon, 11 Oct 2010 09:12:41 +0000</lastBuildDate>
	<language>cs</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.7</generator>

<image>
	<url>https://jiri.kratochvil.eu/wp-content/uploads/2018/10/kratochvil-logo-100x100.png</url>
	<title>Tomcat &#8211; Jiří Kratochvíl</title>
	<link>https://jiri.kratochvil.eu</link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">10187198</site>	<item>
		<title>How to enable HTTPS on Tomcat</title>
		<link>https://jiri.kratochvil.eu/https-on-tomcat/</link>
					<comments>https://jiri.kratochvil.eu/https-on-tomcat/#respond</comments>
		
		<dc:creator><![CDATA[Jiří Kratochvíl]]></dc:creator>
		<pubDate>Mon, 11 Oct 2010 09:12:41 +0000</pubDate>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Návody]]></category>
		<category><![CDATA[Programování]]></category>
		<category><![CDATA[English]]></category>
		<category><![CDATA[J2EE]]></category>
		<category><![CDATA[linkedin]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Tomcat]]></category>
		<guid isPermaLink="false">http://jiri.kratochvil.eu/?p=332</guid>

					<description><![CDATA[In this article I would like to describe how to enable SSL support in Tomcat. Basically it is a few steps, but there will be [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>In this article I would like to describe how to enable SSL support in Tomcat. Basically it is a few steps, but there will be recorded for cases when some of my colleague asked me <img src="https://s.w.org/images/core/emoji/15.0.3/72x72/1f642.png" alt="🙂" class="wp-smiley" style="height: 1em; max-height: 1em;" /><br />
<span id="more-332"></span><br />
The first step is  creating a server certificate. It is possible to create in two different ways. Either you can create &#8222;self-signed certificate&#8220; or you can import certificate issued by some certification authority.</p>
<p>In this article we will create a self-signed certificate and then configure Tomcat to use the certificate. This configuration is enough for development.</p>
<p>For creating a server certificate, we will use <code>keytool</code> utility  of the JDK.</p>
<p>On Windows</p>
<pre lang="bash">%JAVA_HOME%binkeytool-genkey-alias tomcat-keyalg RSA</pre>
<p>On Linux</p>
<pre lang="bash">$JAVA_HOME/bin/keytool-genkey-alias tomcat-keyalg RSA</pre>
<p>Then uncomment the file server. (XML configuration file of Tomcat) this section:</p>
<pre lang="xml">
<!-- Define a SSL HTTP/1.1 Connector on port 8443          
        This connector uses the JSSE configuration, when using APR, the           
        connector should be using the OpenSSL style configuration           
       described in the APR documentation -->
<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
               maxThreads="150" scheme="https" secure="true"
               clientAuth="false" sslProtocol="TLS" />
</pre>
<p>And thats all. Your server supports both in SLL and non-SSL connections.</p>
<h2>Forcing SSL</h2>
<p>In case you need to make all connections to your application has been secured with SSL, and even when a user enters the address only as <strong>http</strong> you can use the following. </p>
<p>Edit the web.xml file of your application by adding the following element:</p>
<pre lang="xml">
<security-constraint>
        <display-name>AppOverSSL</display-name>
        <web-resource-collection>
            <web-resource-name>
                ResourceName
            </web-resource-name>
            <url-pattern>/</url-pattern>
            <http-method>POST</http-method>
            <http-method>GET</http-method>
        </web-resource-collection>
        <user-data-constraint>
            <transport-guarantee>CONFIDENTIAL</transport-guarantee>
        </user-data-constraint>
    </security-constraint>
</pre>
<p>Don&#8217;t forget to define right port number for SSL in your server.xml file in attribute <strong>redirectPort</strong> of element that is defined your unsecured connection:</p>
<pre lang="xml">
    <!-- A "Connector" represents an endpoint by which requests are received
         and responses are returned. Documentation at :
         Java HTTP Connector: /docs/config/http.html (blocking & non-blocking)
         Java AJP  Connector: /docs/config/ajp.html
         APR (HTTP/AJP) Connector: /docs/apr.html
         Define a non-SSL HTTP/1.1 Connector on port 8080
    -->
    <Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />
</pre>
<p>Now when users use non-secured connection is redirected on HTTPS connection.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://jiri.kratochvil.eu/https-on-tomcat/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">332</post-id>	</item>
	</channel>
</rss>
