Re: automatically redirect http to https in tomcat

2003-02-12 Thread Martin Jacobson
[EMAIL PROTECTED] wrote:

Is it possible to automatically redirect any http request to https in an
Apache + Tomcat environment? For example, If I enter
http://my.domain.com/mycontext http://my.domain.com/mycontext , I would be
automatically redirected to https://my.domain.com/mycontext?



Yes, I do it!
What needs to be remembered is that since you are doing the SSL bit in 
Apache, you don't use the 'transport guarantee' thang in Tomcat (which 
is how Tomcat 'knows' it has to switch to HTTPS). SO, on my site, I have 
an unprotected home page .../drs/home with a link to the protected home 
page .../drs/private/home. Along the way, Tomcat authenticates the user 
via my login form .../drs/login. The login form (and every subsequent 
page of course) needs to be SSL-encrypted.

So, here's how I do this in httpd.conf...

VirtualHost macx.ei.jrc.it
ServerName macx.ei.jrc.it

 hostname:/drs 
	# Redirect Tomcat's http:.../login request to https:.../login
	#
	Redirect /drs/login https://macx.ei.jrc.it/drs/login
	Redirect /drs/private/home https://macx.ei.jrc.it/drs/private/home

# Static files
Alias /drs /usr/local/tomcat/webapps/drs

Directory /usr/local/tomcat/webapps/drs
Options Indexes FollowSymLinks
DirectoryIndex web/index.html
/Directory


# Deny direct access to WEB-INF and META-INF
#
Location /drs/WEB-INF/*
AllowOverride None
deny from all
/Location

Location /drs/META-INF/*
AllowOverride None
deny from all
/Location

JkMount /drs/home  ajp13
JkMount /drs/auth_error  ajp13
JkMount /drs/login_error  ajp13
/VirtualHost

VirtualHost macx.ei.jrc.it:443

	#  General setup for the virtual host
	DocumentRoot /usr/local/apache2/htdocs
	ServerName macx.ei.jrc.it:443
	ServerAdmin [EMAIL PROTECTED]
	ErrorLog logs/error_log
	TransferLog logs/access_log
	
	SSLEngine on
	SSLCipherSuite 
ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
	SSLCertificateFile /usr/local/apache2/conf/ssl.crt/macx.crt
	SSLCertificateKeyFile /usr/local/apache2/conf/ssl.crt/macx-private.key
	Files ~ /drs/login
		SSLOptions +StdEnvVars
	/Files
	Directory /drs/private
		SSLOptions +StdEnvVars
	/Directory
	
	SetEnvIf User-Agent .*MSIE.* \
			 nokeepalive ssl-unclean-shutdown \
			 downgrade-1.0 force-response-1.0
	CustomLog logs/ssl_request_log \
			  %t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \%r\ %b

 macx.ei.jrc.it/drs 

# Static files
Alias /drs /usr/local/tomcat/webapps/drs

Directory /usr/local/tomcat/webapps/drs
Options Indexes FollowSymLinks
DirectoryIndex /web/index.html
/Directory


# Deny direct access to WEB-INF and META-INF
#
Location /drs/WEB-INF/*
AllowOverride None
deny from all
/Location

Location /drs/META-INF/*
AllowOverride None
deny from all
/Location

JkMount /drs/j_security_check  ajp13
JkMount /drs/private/*  ajp13
JkMount /drs/auth_error  ajp13
JkMount /drs/login  ajp13
/VirtualHost


HTH

Martin


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: automatically redirect http to https in tomcat

2003-02-11 Thread Jake Robb
The only way I can think of to do that is to mirror your secure content with
nonsecure matching pages with either META or Javascript redirects, or using
JSP (PHP and other server-side languages could do it too) to do a header
write.



- Original Message -
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, February 11, 2003 4:11 PM
Subject: automatically redirect http to https in tomcat


 Is it possible to automatically redirect any http request to https in an
 Apache + Tomcat environment? For example, If I enter
 http://my.domain.com/mycontext http://my.domain.com/mycontext , I would
be
 automatically redirected to https://my.domain.com/mycontext?



 Regards,







 PQ



 This Guy Thinks He Knows Everything

 This Guy Thinks He Knows What He Is Doing






-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: automatically redirect http to https in tomcat

2003-02-11 Thread Mohamed Nasser
In the httpd.conf under the virtual host listening to port 80 have the line
RedirectPermanent / https://my.domain.com 
if you want it to do for specific content you may have to play with the above 
statement or redirect rules. The above would be for all http requests.
-MN

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Tue, February 11, 2003 4:12 PM
To: [EMAIL PROTECTED]
Subject: automatically redirect http to https in tomcat


Is it possible to automatically redirect any http request to https in an
Apache + Tomcat environment? For example, If I enter
http://my.domain.com/mycontext http://my.domain.com/mycontext , I would be
automatically redirected to https://my.domain.com/mycontext?

 

Regards,

 

 

 

PQ

 

This Guy Thinks He Knows Everything

This Guy Thinks He Knows What He Is Doing

 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: automatically redirect http to https in tomcat

2003-02-11 Thread pqin
Actually I want to force the https access of my context

1. I included ssl.conf in httpd.conf.

2. In ssl.conf, I enabled SSL and

VirtualHost _default_:*
ServerName my.domain.com:443
..
/VirtualHost

3. In my server.xml, the only connector loaded is a secure one.

Connector className=org.apache.coyote.tomcat4.CoyoteConnector
port=8009 .. redirectPort=8443
scheme=https secure=true
../

I assume any http request will be automatically redirected as https to 8443.
However, if I type http://my.domain.com/mycontext, apache gave me a bad
Request page.

Bad Request
Your browser sent a request that this server could not understand.
Reason: You're speaking plain HTTP to an SSL-enabled server port.
Instead use the HTTPS scheme to access this URL, please.


Hint: https://my.domain.com/


Am I totally wrong? Any thought besides RedirectPermanent and the above
no-user-friendly remind?


Regards,
 
 
PQ
 
This Guy Thinks He Knows Everything
This Guy Thinks He Knows What He Is Doing

-Original Message-
From: Mohamed Nasser [mailto:[EMAIL PROTECTED]] 
Sent: February 11, 2003 4:23 PM
To: Tomcat Users List
Subject: RE: automatically redirect http to https in tomcat

In the httpd.conf under the virtual host listening to port 80 have the line
RedirectPermanent / https://my.domain.com 
if you want it to do for specific content you may have to play with the
above statement or redirect rules. The above would be for all http requests.
-MN

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Tue, February 11, 2003 4:12 PM
To: [EMAIL PROTECTED]
Subject: automatically redirect http to https in tomcat


Is it possible to automatically redirect any http request to https in an
Apache + Tomcat environment? For example, If I enter
http://my.domain.com/mycontext http://my.domain.com/mycontext , I would be
automatically redirected to https://my.domain.com/mycontext?

 

Regards,

 

 

 

PQ

 

This Guy Thinks He Knows Everything

This Guy Thinks He Knows What He Is Doing

 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: automatically redirect http to https in tomcat

2003-02-11 Thread SSchaubach
PQ,
Are you using struts? if so I may be able to help you.

Best,

Stephen Schaubach


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 11, 2003 1:12 PM
To: [EMAIL PROTECTED]
Subject: automatically redirect http to https in tomcat
Importance: Low


Is it possible to automatically redirect any http request to https in an
Apache + Tomcat environment? For example, If I enter
http://my.domain.com/mycontext http://my.domain.com/mycontext , I would be
automatically redirected to https://my.domain.com/mycontext?

 

Regards,

 

 

 

PQ

 

This Guy Thinks He Knows Everything

This Guy Thinks He Knows What He Is Doing

 




RE: automatically redirect http to https in tomcat

2003-02-11 Thread pqin
Yes, I use struts. It used to automatically redirect http request to https
with https setup in ssl.conf. After I upgraded to b3, 4.1.18, 2.0.44, http
is http and https is https.

Regards,
 
 
PQ
 
This Guy Thinks He Knows Everything
This Guy Thinks He Knows What He Is Doing

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] 
Sent: February 11, 2003 5:13 PM
To: [EMAIL PROTECTED]
Subject: RE: automatically redirect http to https in tomcat

PQ,
Are you using struts? if so I may be able to help you.

Best,

Stephen Schaubach


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 11, 2003 1:12 PM
To: [EMAIL PROTECTED]
Subject: automatically redirect http to https in tomcat
Importance: Low


Is it possible to automatically redirect any http request to https in an
Apache + Tomcat environment? For example, If I enter
http://my.domain.com/mycontext http://my.domain.com/mycontext , I would be
automatically redirected to https://my.domain.com/mycontext?

 

Regards,

 

 

 

PQ

 

This Guy Thinks He Knows Everything

This Guy Thinks He Knows What He Is Doing

 




RE: automatically redirect http to https in tomcat

2003-02-11 Thread SSchaubach
Ok then,
  In the struts config you would present the view with not just a relative
path but a full path with https://etc

Best,

Stephen

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 11, 2003 2:22 PM
To: [EMAIL PROTECTED]
Subject: RE: automatically redirect http to https in tomcat
Importance: Low


Yes, I use struts. It used to automatically redirect http request to https
with https setup in ssl.conf. After I upgraded to b3, 4.1.18, 2.0.44, http
is http and https is https.

Regards,
 
 
PQ
 
This Guy Thinks He Knows Everything
This Guy Thinks He Knows What He Is Doing

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] 
Sent: February 11, 2003 5:13 PM
To: [EMAIL PROTECTED]
Subject: RE: automatically redirect http to https in tomcat

PQ,
Are you using struts? if so I may be able to help you.

Best,

Stephen Schaubach


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 11, 2003 1:12 PM
To: [EMAIL PROTECTED]
Subject: automatically redirect http to https in tomcat
Importance: Low


Is it possible to automatically redirect any http request to https in an
Apache + Tomcat environment? For example, If I enter
http://my.domain.com/mycontext http://my.domain.com/mycontext , I would be
automatically redirected to https://my.domain.com/mycontext?

 

Regards,

 

 

 

PQ

 

This Guy Thinks He Knows Everything

This Guy Thinks He Knows What He Is Doing

 




Re: automatically redirect http to https in tomcat

2003-02-11 Thread Steinar Bang
 [EMAIL PROTECTED]:

 Yes, I use struts. It used to automatically redirect http request to
 https with https setup in ssl.conf. After I upgraded to b3, 4.1.18,
 2.0.44, http is http and https is https.

What I've done in Struts, is to subclass ActionServlet, replace the
doGet() and doPost() methods, and in the replaced methods test if
HttpServletRequest.isSecure() is true or false, and if false, redirect
to an HTTPS URL.

This worked with Tomcat 3.2 and the Jk connector to apache, but
didn't work with Tomcat 4.1.12 and the Coyote connector (I had to use
the Jk connector), but it now works with tomcat 4.1.18 and the Coyote
connector (which seems to be able to handle a lot more traffic than
the okd Jk connector).


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: automatically redirect http to https in tomcat

2003-02-11 Thread Oscar Carrillo
I got this working by using separate jkmounts for two different virtual 
hosts. One for http, the other for https.

Then I have a redirect to move to specific page.

Please see my complete description of my setup at
http://daydream.stanford.edu/tomcat/install_web_services.html

Oscar

On Tue, 11 Feb 2003 [EMAIL PROTECTED] wrote:

 Yes, I use struts. It used to automatically redirect http request to https
 with https setup in ssl.conf. After I upgraded to b3, 4.1.18, 2.0.44, http
 is http and https is https.
 
 Regards,
  
  
 PQ
  
 This Guy Thinks He Knows Everything
 This Guy Thinks He Knows What He Is Doing
 
 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] 
 Sent: February 11, 2003 5:13 PM
 To: [EMAIL PROTECTED]
 Subject: RE: automatically redirect http to https in tomcat
 
 PQ,
 Are you using struts? if so I may be able to help you.
 
 Best,
 
 Stephen Schaubach
 
 
 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, February 11, 2003 1:12 PM
 To: [EMAIL PROTECTED]
 Subject: automatically redirect http to https in tomcat
 Importance: Low
 
 
 Is it possible to automatically redirect any http request to https in an
 Apache + Tomcat environment? For example, If I enter
 http://my.domain.com/mycontext http://my.domain.com/mycontext , I would be
 automatically redirected to https://my.domain.com/mycontext?
 
  
 
 Regards,
 
  
 
  
 
  
 
 PQ
 
  
 
 This Guy Thinks He Knows Everything
 
 This Guy Thinks He Knows What He Is Doing
 
  
 
 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: automatically redirect http to https in tomcat

2003-02-11 Thread Oscar Carrillo
One more thing. Make sure NOT to use an include for the mod_jk.conf file.
Then it becomes global and screws you up. At least that's what I figured 
was happening.

Oscar

On Tue, 11 Feb 2003, Oscar Carrillo wrote:

 I got this working by using separate jkmounts for two different virtual 
 hosts. One for http, the other for https.
 
 Then I have a redirect to move to specific page.
 
 Please see my complete description of my setup at
 http://daydream.stanford.edu/tomcat/install_web_services.html
 
 Oscar
 
 On Tue, 11 Feb 2003 [EMAIL PROTECTED] wrote:
 
  Yes, I use struts. It used to automatically redirect http request to https
  with https setup in ssl.conf. After I upgraded to b3, 4.1.18, 2.0.44, http
  is http and https is https.
  
  Regards,
   
   
  PQ
   
  This Guy Thinks He Knows Everything
  This Guy Thinks He Knows What He Is Doing
  
  -Original Message-
  From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] 
  Sent: February 11, 2003 5:13 PM
  To: [EMAIL PROTECTED]
  Subject: RE: automatically redirect http to https in tomcat
  
  PQ,
  Are you using struts? if so I may be able to help you.
  
  Best,
  
  Stephen Schaubach
  
  
  -Original Message-
  From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
  Sent: Tuesday, February 11, 2003 1:12 PM
  To: [EMAIL PROTECTED]
  Subject: automatically redirect http to https in tomcat
  Importance: Low
  
  
  Is it possible to automatically redirect any http request to https in an
  Apache + Tomcat environment? For example, If I enter
  http://my.domain.com/mycontext http://my.domain.com/mycontext , I would be
  automatically redirected to https://my.domain.com/mycontext?
  
   
  
  Regards,
  
   
  
   
  
   
  
  PQ
  
   
  
  This Guy Thinks He Knows Everything
  
  This Guy Thinks He Knows What He Is Doing
  
   
  
  
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: automatically redirect http to https in tomcat

2003-02-11 Thread Jacob Kjome

This is part of the servlet spec.  Use a transport guarantee.  You won't 
have to do any extra coding.

security-constraint
web-resource-collection
web-resource-nameTomcat/web-resource-name
url-pattern/*/url-pattern
/web-resource-collection
user-data-constraint
transport-guaranteeCONFIDENTIAL/transport-guarantee
/user-data-constraint
/security-constraint


Jake

At 05:22 PM 2/11/2003 -0500, you wrote:
Yes, I use struts. It used to automatically redirect http request to https
with https setup in ssl.conf. After I upgraded to b3, 4.1.18, 2.0.44, http
is http and https is https.

Regards,


PQ

This Guy Thinks He Knows Everything
This Guy Thinks He Knows What He Is Doing

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: February 11, 2003 5:13 PM
To: [EMAIL PROTECTED]
Subject: RE: automatically redirect http to https in tomcat

PQ,
Are you using struts? if so I may be able to help you.

Best,

Stephen Schaubach


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 11, 2003 1:12 PM
To: [EMAIL PROTECTED]
Subject: automatically redirect http to https in tomcat
Importance: Low


Is it possible to automatically redirect any http request to https in an
Apache + Tomcat environment? For example, If I enter
http://my.domain.com/mycontext http://my.domain.com/mycontext , I would be
automatically redirected to https://my.domain.com/mycontext?



Regards,







PQ



This Guy Thinks He Knows Everything

This Guy Thinks He Knows What He Is Doing