aspose file tools*
The moose likes Struts and the fly likes Switching between http and https in struts-config Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Switching between http and https in struts-config" Watch "Switching between http and https in struts-config" New topic
Author

Switching between http and https in struts-config

Dan Tenenbaum
Greenhorn

Joined: Apr 19, 2005
Posts: 6
I'm working on a webapp where some of the pages should be accessed through HTTPS and others through HTTP.

For example, login and registration need to be secure, but once the registration is done and we go to the user home page, we can go back to the nonsecure site.

All pages, secure and nonsecure, are being served by the same Tomcat instance.

I'm wondering about the best way to handle this in the struts config file. If you are allowed to put absolute URLS in a forward "path" attribute, that could be one solution, but it loses portability and that file has to be edited every time we want to deploy the app to another machine with another hostname.

To be more concrete, let's say we go to this page:
https://mysite.com/appname/login.do

The action contains multiple forwards, all of which will continue to be served by https since we started with an https url. But I want at least one of those forwards to return to the nonsecure site. (I also want to do the converse).

Anyone have some ideas on this?
Thanks
Rusty Enisin
Ranch Hand

Joined: May 26, 2005
Posts: 107
You will need to write a filter that will check to see if the page is using http or https. If the requested page is in a non-secure area, send a redirect to the user's browser with the corrected url. You can do the same going the other way from http to https.


The squeaky wheel gets the grease. Well, that or replaced...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Switching between http and https in struts-config
 
Similar Threads
secure nonsecure warning
Removing warning message for nonsecure items
Secure and nonsecure items warning. CSS Trouble?
secure nonsecure warning in IE
Secure and Nonsecure Items