> 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/
>
>
Hi Mark,
I didn't realise that there was the https() routine in CGI.pm, although
having looked at the source it seems to just check to if you are on port 443
and allows easy access to the SSL environment variables.
I will probably use it, since it is there.
I had considered using the meta refresh tags but have always disliked them
as they do not seem very professional but will probably end up having to do
it that way.
But the only way I can think of been able to do that, is changing the run
mode to a run mode that outputs the explanation text and the meta refresh
tags.
So I have a further questions.
Is there anyway to automatically add a run mode to every module, possible by
modifying the setup routine in a super-class.
Thanks,
Adam
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.512 / Virus Database: 309 - Release Date: 20/08/2003
---------------------------------------------------------------------
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]