Return-Path: Delivered-To: apmail-tomcat-users-archive@www.apache.org Received: (qmail 39919 invoked from network); 29 Mar 2011 22:10:13 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 29 Mar 2011 22:10:13 -0000 Received: (qmail 24489 invoked by uid 500); 29 Mar 2011 22:10:10 -0000 Delivered-To: apmail-tomcat-users-archive@tomcat.apache.org Received: (qmail 24331 invoked by uid 500); 29 Mar 2011 22:10:10 -0000 Mailing-List: contact users-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Users List" Delivered-To: mailing list users@tomcat.apache.org Received: (qmail 24322 invoked by uid 99); 29 Mar 2011 22:10:10 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 29 Mar 2011 22:10:10 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [80.237.132.197] (HELO wp190.webpack.hosteurope.de) (80.237.132.197) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 29 Mar 2011 22:10:02 +0000 Received: from p5df4dc4d.dip.t-dialin.net ([93.244.220.77] helo=[10.1.1.251]); authenticated by wp190.webpack.hosteurope.de running ExIM with esmtpa id 1Q4h6a-00075P-3g; Wed, 30 Mar 2011 00:09:40 +0200 Message-ID: <4D9258A2.4040907@mayr-stefan.de> Date: Wed, 30 Mar 2011 00:09:38 +0200 From: Stefan Mayr User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; de; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9 MIME-Version: 1.0 To: users@tomcat.apache.org Subject: Re: Simulating HTTPS in terminated SSL/Apache 2/Tomcat 6 cluster References: <4D91B44E.20709@kippdata.de> In-Reply-To: <4D91B44E.20709@kippdata.de> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-bounce-key: webpack.hosteurope.de;stefan@mayr-stefan.de;1301436602;60a2c650; Hi Am 29.03.2011 12:28, schrieb Rainer Jung: > On 29.03.2011 12:07, Richard Levy wrote: >>... >> The current setup involves two intelligent load-balancers that >> terminates SSL then hands over to Oracle 10g. The 10g stack has >> custom Oracle versions of Apache which have configuration options not >> found in standard Apache and appear to have made configuration >> simpler. For instance, there is a "simulateHttps" directive that you >> can give to a virtual host in Oracle Apache which does not exist in >> the standard version. Using that option, we simply have 2 virtual >> hosts defined in Apache, one for http traffic and one for https >> traffic (with simulateHttps set to on). They both forward to OC4J and >> it works fine. > > You can achieve this with standard Apache and mod_jk esily to. That's what we have in production: 1. Our "intelligent" Loadbalancer controls an additional HTTP-Request-Header Front-End-Https (default off, on when using SSL). 2. Our Apache is one VirtualHost using the following block for SSL detection: # Fake SSL if Loadbalancer does SSL-Offload SetEnvIf Front-End-Https "^on$" HTTPS=on Advantage: 1. as we use the same backend for ssl and non-ssl-traffic the session affinity still works switching between HTTP and HTTPS 2. Reduced Apache configuration as we don't need to double VirtualHosts for SSL 3. Transparent to the Java Applications. The Application won't notice we've cheated :-) >> With the new architecture we have two load-balancer which round-robin >> to two Apache servers. These servers connect to two Tomcat servers >> which are configured with a mod_jk loadbalancer using session >> affinity. Through config we have separated HTTP& HTTPS traffic. We >> have done this because the application needs to identify when it is >> secure, which we do by simulating HTTP using settings in the connector >> in the Tomcat server.xml. This is detailed further down. >> >> Obviously we want to keep the same functionality on the Apache/Tomcat >> stack, and also retain the termination of SSL at the load-balancer, >> but are having trouble when the application switches to HTTPS. It >> works fine if we have a single Tomcat instance running, but once the >> 2nd Tomcat instance is enabled, moving to HTTPS fails because a new >> session is created. > > I went only brievly thourgh your configuration list and communication > behavior, but thanks for the details! > > I suggest you try the following: > > - use only one connector per Tomcat instance, so > only one jvmRoute and only one worker per Tomcat > > - let Apache via mod_jk inform the connector, > whether the request came via HTTP or (fake) HTTPS > > - still do the redirect, but now because of only one connector you > have only one jvmRoute and only one worker per Tomcat. > So stickyness should work again. > > How can Apache forward the HTTP vs. (fake) HTTPS info via mod_jk? > > mod_jk automatically forwards the info whether the request was HTTPS. > When the application checks it, the Tomcat AJP connector retrieves the > info from what mod_jk forwarded it was and presents it to the > application. AJP itself is never encrypted. > > Where does mod_jk get the info from? By default it checks an Apache > environment variable named "HTTPS", which is set by Apache whenever it > handles an HTTPS request. > > You can also set the HTTPS environment variable by your Apache config, > but it is better to understand not to overload the meaning of the variable. > > Instead: > > - tell mod_jk to look for another, private variable which contains the > info whether the rquest was HTTP or (fake) HTTPS: > > JkHTTPSIndicator MyHTTPSVariable > > (you can choose the name MyHTTPSVariable) > > - set the variable "MyHTTPSVariable" to "On" in the Apache > Virtual Host that receives your fake HTTPS requests > > SetEnv JkHTTPSIndicator On > > (for this mod_env must be enabled) > > That's it :) Guess that's cleaner then what we did. I'll put swapping HTTPS with JkHTTPSIndicator on my todo-list. Stefan --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org For additional commands, e-mail: users-help@tomcat.apache.org