Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hello There! Thank you for your reply but my code is still not working. I had tried several ways as suggested but still not working. I just need to be able to direct to multiple IP addresses. Right now, the code is working fine but only connect to one IP address.
$address = $ENV{'REMOTE_HOST'}; $ipaddress = $ENV{'REMOTE_ADDR'}; $redirect = "telnet://" .$ipaddress ; if ( $in{'port'} ne "" ) { $redirect .= "telnet://" . $port; } $redirect .= "/"; print "Content-type: text/html\n"; print "Location: $redirect\n\n"; print "You should have been redirected to <a href=\"$redirect\">$redir +ect</a>"; exit;
I really appreciate if someone could help me with my code. Thanks

Replies are listed 'Best First'.
Re: direct to multiple IP addresses
by chromatic (Archbishop) on Sep 18, 2001 at 02:40 UTC
    There's nothing wrong with your code. It's a limitation of HTTP. RFC 2616 indicates that you can only redirect to a single URI.

    Jerry's reply to your original question offers the most practical solution. You can set a JavaScript timer, pop up multiple new windows, or set an onClose() handler to redirect to the next IP address.

    There's just no way to do it in one shot with Perl on the server. It's not Perl's fault, it's not your fault. It's the way the process works.