Apache as SSL front-end for lame web app

Brian Chabot brian at datasquire.net
Thu Nov 9 10:30:48 EST 2006


Ben Scott wrote:

>  I want to put an Apache box in front of it, and have Apache turn
> plain old HTTP into HTTPS, and also add a separate username/password
> prompt system to protect the lame app from being touched by anyone who
> doesn't at least have *some* credentials.  Basically, turning a lame
> application with a "trusted LAN only" mentality to something might
> actually be safe to put on teh Interwebs.


...just because I've been working with Mech at work... This is untested
and will need some modification...

In a directory with a .htpasswd to add security, add this as the 404
error doc:

#!/usr/bin/perl
use CGI;
use WWW::Mechanize;
$baseURL = "http://address/directory/of/this/script";
$lameURL = "http://address/directory/of/lame/app";
$URL = $query->url
$URL =~ s/$baseURL/$lameURL/;
my $mech = WWW::Mechanize->new( autocheck => 1     );
$mech->get( $URL );
print header; # Tell the user's browser this is to be an HTML doc...
#
### NOTE: Make sure you reformat the links for this script's location
# Do that HERE. (Or do it in Mech...)
#
print $mech->content();
# End.


Brian





More information about the gnhlug-discuss mailing list