• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Redirecting to HTTPS

 
Saikiran Kochi
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

How to make secure my page by redirecting to "https" from "http" request?
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can do it declaratively with security-constraint entries in web.xml or
you can do it programmatically by reading the isSecure property from the request object and redirecting to the secure version of you page yourself.

Filters are a nice place to put this code.
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch.

Adding a security constraint like the following to your web.xml will require HTTPS for all URLs:
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic