#!/usr/bin/perl --
use strict;
use warnings;
use CGI;

my $q = CGI->new;
my %headers = map { $_ => $q->http($_) } $q->http();
my ($url,$query) = split /\?/, $headers{'HTTP_REFERER'}, 2;

my $redirect = "/cwa/cgi-bin/legacylogin.pl?" . $query;
print $q->redirect(-location => $redirect);

exit;