I wrote a handler to do it.  
(BTW, I hope this helps, but PLEASE feel free to give criticisms and
suggestions.  I'm new to Apache/modperl/etc. =o)

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# module for Apache/mod_perl PerlPostReadRequestHandler to redirect
#  users on the nonsecure port over to SSL (hopefully saving bookmarks)
#______________________________________________________________________

package Apache::PortCorrect;

use strict;
use Apache::Constants qw( :response :methods );
use Carp ();
$SIG{__WARN__} = \&Carp::cluck;

sub handler {
     my($r,$s,$url,$args,$uri);
     $r = shift;   # the request object
     return OK if 443 == $r->get_server_port;
     (undef,$url,undef) = split(/\s+/o, $r->the_request);
     # allow HTTP:// access to some core pages and to graphics
     return OK if $url =~ m{ ^(?:/
                           | /(public|teampages|pics|avgrates)/.*
                           | /(home|cook)[.]shtml
                           | .*[.](gif|jpg)
                              )$
                           }ixo;
     # else redirect to the secure server
     $uri = "https://$our_server.com" . $url; # edited :o)
     $args = $r->args;
     $uri .= "?$args" if $args;
     $r->custom_response(MOVED,$uri);
     return MOVED;
}

1; # guarantee return code for load

######################################################
In the config file, I just said (with minimal edit): 
PerlModule                  Apache::PortCorrect
PerlPostReadRequestHandler  Apache::PortCorrect
######################################################

Hope that helps. 

Paul
====

--- "Airey, John" <[EMAIL PROTECTED]> wrote:
> A user redirect in the head a web page at
> http://www/mydomain.com/michel
> such as
> 
> <META HTTP-EQUIV="refresh" CONTENT="1;
> URL=https://www/mydomain.com/michel">
> 
> 
> Would achieve this (redirecting after 1 second). However, the secure
> document root would have to be different!
> 
> I don't think (AFAIK) there's a way for a web server to do this.
> 
> - 
> John Airey
> Internet Systems Support Officer, ITCSD, Royal National Institute for
> the
> Blind,
> Bakewell Road, Peterborough PE2 6XU,
> Tel.: +44 (0) 1733 375299 Fax: +44 (0) 1733 370848
> [EMAIL PROTECTED] 
> 
> 
> -----Original Message-----
> From: michel [mailto:[EMAIL PROTECTED]]
> Sent: 14 June 2000 16:46
> To: [EMAIL PROTECTED]
> Subject: Auto HTTPS
> 
> 
> Hi, I have a site with SSL. I want that if a user came in
> http://www/mydomain.com/michel via automatic the user is redirect to
> https://www/mydomain.com/michel
> 
> I have see manual, but I'm a newbie in regular expression. 
> In httpd.conf I have:
> <Directory /usr/local/apache-1.3.12/htdocs/michel>
>         Order allow,deny
>             Allow from all
>         RewriteEngine        on
>         RewriteCond  %{HTTPS} !=on
>         RewriteRule  (.*) https://%{SERVER_NAME}/ [R,L]
>         #RewriteRule   * https://%{SERVER_NAME}/$1
>         </Directory>
> 
> out of every <IfModule> 
> 
> Tnx in advance
> 
> both them (Windows and M. Lewinski) suck a lot and both them are
> are giving Bill some trouble.
> --
> Michel <ZioBudda> Morelli               [EMAIL PROTECTED]
> 
> ICQ UIN: 58351764                       PR of PhpItalia.com
> http://www.ziobudda.net                 http://faq.ziobudda.net
> 
>
______________________________________________________________________
> Apache Interface to OpenSSL (mod_ssl)                  
> www.modssl.org
> User Support Mailing List                     
> [EMAIL PROTECTED]
> Automated List Manager                           
> [EMAIL PROTECTED]
>
______________________________________________________________________
> Apache Interface to OpenSSL (mod_ssl)                  
> www.modssl.org
> User Support Mailing List                     
> [EMAIL PROTECTED]
> Automated List Manager                           
[EMAIL PROTECTED]


__________________________________________________
Do You Yahoo!?
Yahoo! Photos -- now, 100 FREE prints!
http://photos.yahoo.com
______________________________________________________________________
Apache Interface to OpenSSL (mod_ssl)                   www.modssl.org
User Support Mailing List                      [EMAIL PROTECTED]
Automated List Manager                            [EMAIL PROTECTED]

Reply via email to