How to redirect the application to https for particular urls

I

itmohan2002

Hi All,

In my web application, i would like to redirect to https to some urls
(ex:- registration, posting)
Iam using struts framework, Ibatis and sever Tomcat 5.0.
How can i redirect to https for particular urls and the next coming
pages should come back to http.
ex:-
--------------------------------------------------------------------------------
http://www.myapp.com
https://www.myapp.com/register.do
http://www.myapp.com/thankyou.do

--------------------------------------------------------------------------------

Struts-config.xml

--------------------------------------------------------------------------------
<!-- ======== REGISTRATION ===== -->
<action attribute="registerForm" name="registerForm" path="/
registration" validate="false"
type="com.app.registration.RegisterAction">
<forward name="registration" path="/registration/registration.jsp"/>
<forward name="alreadyLoggedIn" path="/edit-profile.do"/>
</action>
<!-- ======== CONFIRM REGISTRATION ===== -->
<action attribute="registerForm" name="registerForm" path="/thankyou-
registration" validate="false"
type="com.app.registration.RegisterAction">
<forward name="registerFailure" path="/registration/registration.jsp"/<forward name="successRegistration" path="/registration/thankyou-new-
registration.jsp"/>
</action>
 
J

Jeffrey H. Coffield

Hi All,

In my web application, i would like to redirect to https to some urls
(ex:- registration, posting)
Iam using struts framework, Ibatis and sever Tomcat 5.0.
How can i redirect to https for particular urls and the next coming
pages should come back to http.
ex:-
--------------------------------------------------------------------------------
http://www.myapp.com
https://www.myapp.com/register.do
http://www.myapp.com/thankyou.do

--------------------------------------------------------------------------------

Struts-config.xml

--------------------------------------------------------------------------------
<!-- ======== REGISTRATION ===== -->
<action attribute="registerForm" name="registerForm" path="/
registration" validate="false"
type="com.app.registration.RegisterAction">
<forward name="registration" path="/registration/registration.jsp"/>
<forward name="alreadyLoggedIn" path="/edit-profile.do"/>
</action>
<!-- ======== CONFIRM REGISTRATION ===== -->
<action attribute="registerForm" name="registerForm" path="/thankyou-
registration" validate="false"
type="com.app.registration.RegisterAction">
<forward name="registerFailure" path="/registration/registration.jsp"/
<forward name="successRegistration" path="/registration/thankyou-new-
registration.jsp"/>
</action>

I don't know struts very well, but isn't this usually done in Apache
running in front of Tomcat?

Jeff
 
M

Mark Space

Jeffrey said:
I don't know struts very well, but isn't this usually done in Apache
running in front of Tomcat?

From what I understand about Java EE, it duplicates a lot of things
Apache does. This allows you to run a Java EE under any web server,
because your web app is now described independently of the platform
(Apache, IIS, etc.) it is running on.

In other words, the OP is likely doing the right thing. Sorry that I
don't know enough about struts to puzzle out how to redirect. It should
be easy, just a matter of getting the syntax right.
 
A

Arne Vajhøj

Mark said:
From what I understand about Java EE, it duplicates a lot of things
Apache does. This allows you to run a Java EE under any web server,
because your web app is now described independently of the platform
(Apache, IIS, etc.) it is running on.

Java EE app servers are not running "under" any web server. They run
standalone. The browser can connect directly to them. Or the browser
can go to a web server that forward requests either via AJP or HTTP.

Arne
 
A

Arne Vajhøj

In my web application, i would like to redirect to https to some urls
(ex:- registration, posting)
Iam using struts framework, Ibatis and sever Tomcat 5.0.
How can i redirect to https for particular urls and the next coming
pages should come back to http.

You can require that certain URL's can only be accessed via HTTPS
using <user-data-constraint><transport-guarantee> in web.xml.

You could write a servlet filter that did a redirect for
certain URL's.

That is the two options that I can think of.

Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,821
Latest member
AleidaSchi

Latest Threads

Top