File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Tomcat and the fly likes Redirect to https:// Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Redirect to https://" Watch "Redirect to https://" New topic

Redirect to https://

Marty Finn

Joined: Aug 24, 2007
Posts: 7
If you remember a couple months ago, you guys help me setup an SSL certificate on our web server. Now I need a little more help. All works fine when we type in https://blah.blah.blah but it just comes back with a blank page and says done when we use http://

How can I redirect anyone that uses http:// to automatically change to https://

Tomcat 5.0 (Catalina)

[ October 01, 2007: Message edited by: Marty Finn ]
Paul Clapham

Joined: Oct 14, 2005
Posts: 19868

I use a servlet filter for that. But if you're having a problem with what you did, maybe we should try to fix that up.
Ben Souther

Joined: Dec 11, 2004
Posts: 13410

You can either do this programmatically with a filter, as Paul mentioned, or you can do it declaratively by adding a user-data-constraint entry in your deployment descriptor.

In this example, I've added the CONFIDENTIAL constraint to the tomcat/manager app:

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
I agree. Here's the link:
subject: Redirect to https://
It's not a secret anymore!