File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Tomcat and the fly likes SSL in Tomcat Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "SSL in Tomcat" Watch "SSL in Tomcat" New topic

SSL in Tomcat

Rick Beaver
Ranch Hand

Joined: Dec 14, 2004
Posts: 464
Hi Ranchers

I am trying to enforce SSL on certain pages of my web application.

I am using Tomcat 4.something

I have SSL up and running fine but I have been unable to get the pages I want to only work in SSL to not be available on the normal http connection.

Lets say for example I wanted everything in /secure dir to use SSL exclusively how would I do that?



ph34r my 133t j4v4 h4><0r1ng sk177z
Tim Baker
Ranch Hand

Joined: Oct 04, 2003
Posts: 541
Here's one way you can do it without being tomcat specific.
In your JSP:
<% if (!request.isSecure())
{ %>
Sorry, this webpage is only available over a secure connection. (possibly provide a link to it?)
<% } %>

Kim Jong II (North Korea's Dear Leader) said:Nuclear weapons don't kill people, people kill people.
I agree. Here's the link:
subject: SSL in Tomcat
It's not a secret anymore!