In article <[EMAIL PROTECTED]>, Adam Gent wrote:
> Hi All,
> 
> I am trying to do a redirect to a secure page depending upon a variable in
> the instance script.
> 
> The code I am using is shown below and is within the cgiapp_prerun routine.
> 
> The problem that I get is that the redirect appears to happen but the actual
> URL in the browser is not changed, so http is still displayed. But the
> padlock is shown but clicking on this you just get an error message.
> 
> Does anyone know of a better way of doing this.
> 
>     if (($self->param('SecurePage') == 1) && ($ENV{SERVER_PORT} != 443))
>     {
> 
>         my $url = $query->url(-path_info=>1,-query=>1);
> 
>         $url =~ s/http:\/\//https:\/\//;
> 
>         $self->header_type('redirect');
>         $self->header_props(-url=>$url);
> 
> 
>     }

Adam,

Here's a couple ideas. First, you might be interested to know CGI.pm
provides a way to check if you are in "https" mode. Simple call the
function https(). It returns true in secure mode and false otherwise. It
will be more portable than what you have above.

If redirects using the headers aren't working for you, you could use the
META tag "refresh" syntax. I believe it's widely supported in
browsers, although some privacy-ware may prevent it fom working. For
this reason, direct links on the pages are often provided as
alternatives.

        Mark

--
http://mark.stosberg.com/ 


---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/[EMAIL PROTECTED]/
              http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to