[BLUG] Perl CGI::Session & Redirection from https to http
Gaddis, Jeremy L.
blug_at_mailman.cs.indiana.edu
Thu, 11 Jan 2007 11:14:13 -0500
On 1/10/07, Peter G. Brown <pgb_at_kiva.net> wrote:
> 2. I have seen code for asp in how to redirect from https (same server in my
> case) to http but haven't seen anything that has worked using perl - (print
> redirect ('http://host/news.html'); ) is not redirecting to the http but the
> https.
>
> 3. Which raised this question - my login page is through the https port (again
> same server) e.g. https://ephesus/login.html (test server) but if I enter
> http://ephesus/login.html (the non secure 80 port) it processes my details -
> all non encrypted. I would like some kind of error on loading the page (not
> after entering username & password) and a redirect to https should this
> happen.
I do this quite often, though usually in PHP instead of Perl. What I
do is check the Apache environment variable SERVER_PORT to see if it's
80. If so, send back "Location: https://..." to redirect them to the
SSL-encrypted page. (There's probably a more elegant way to do it,
however.)
I don't use CGI::Session so no help there, sorry.
-j
--
Jeremy L. Gaddis, MCP, GCWN
http://www.linuxwiz.net/