[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cobalt-users] Redirect http to https



>
> Sorry, misunderstood the question..
>
> Make the form a dynamic page, like CGI/ASP/PHP, and have it check the URL
> and make sure it is being accessed securely, and if it's not, reload the
> page over HTTPS..  Otherwise just show the form..  Very simple to write..

I couldn't help myself and wrote-up a simple CGI script that will check the
URL and make sure it is being accessed over HTTPS...

********************* BEGIN CODE *********************

#!/usr/bin/perl
use CGI qw(:standard);
$query = new CGI;
$currentURL = $query->url();
$secureURL = "https://www.domain.com/secureform.cgi;
if ($currentURL eq $secureURL) {
print "Content-type: text/html\n\n";
print "Secure OK, put HTML here...";
} else {
print "Location: $secureURL\n\n";
}
exit;

********************* END CODE *********************

-Jamie-
http://w-c.net
WebConnection.Net, Inc.
In a mad world, only the mad are sane...