This page is provided for historical interest only. See the current Nix on "www." page.

 

Technical info on how to redirect web traffic

 

You can dispense with the prefix "web." or "www." altogether and just use your host name.

[Update 1999-11-06] If you want to do this, be sure to read the page on how to do it with Apache (even if you don't use Apache).

If you have special needs, here is some technical information on how to redirect traffic away from your main host machine onto one or more other machines without using a "web." prefix.


Redirecting traffic from port 80

From: Joe.Smith@tymnet.com
Date: Sun, 14 Jun 1998 04:19:22 -0700 (PDT)

Dave,

For people that are already running UNIX on their main host machine, they can redirect http requests instead of forwarding them. All it takes is a little program running on port 80 that politely says "Please go to the web server over there."

Here is a perl script that does just that. You will need to add one line to /etc/services and one line to /etc/inetd.conf to activate this program. This was originally developed for 4.3BSD, and should work on most any flavor of UNIX, not just Linux.

#!/usr/local/bin/perl
# Name: http-redirect                   Author: Joe.Smith@MCI.com
# Purpose: Dummy http daemon redirects browers to specified www host.
# Usage: Add "http 80/tcp" to /etc/services and add this to /etc/inetd.conf:
# http stream tcp nowait nobody /usr/local/etc/http-redirect to web.company.com

# The default to go to web.company.com unless a different host is specified
$otherhost = @ARGV ? $ARGV[0] : "web.company.com";
$message = <<EOM;
HTTP/1.0 302 redirect
Server: DUMMY/0.0
Location: http://$otherhost/
Content-type: text/html

<HEAD><TITLE>Document moved</TITLE></HEAD><BODY>
<H1>Document moved</H1>
This server has no documents.<P>
Goto <A HREF="http://$otherhost/">$otherhost</A> instead.
</BODY></HTML>
EOM
$message =~ s/\n/\r\n/gm;       # Convert to netascii form, CR+LF
print $message;                 # Tell the browser to go away
exit;


Forwarding traffic on port 80

From: Chris Ausbrooks <causbrooks@acic.state.ar.us>
Date: Thu, 18 Sep 1997 14:31:39 -0500

Dave,

The following links have info on forwarding port 80 (http) traffic to a separate server using the Linux operating system.


http://sunsite.unc.edu/LDP/HOWTO/Firewall-HOWTO-6.html http://www.xos.nl/linux/ipfwadm/ http://www.xos.nl/linux/ipfwadm/ipfwadm.8.html

Linux is a free implementation of Unix and makes an excellent server platform. Most of the networking code is contained directly in the kernel, which results in very good performance. I have used Linux boxes to serve web, dial-up, ftp, usenet, CIFS (Microsoft file sharing), IPX, NFS, and others. It consistently outperforms NT on the same hardware. There are currently ports of it which will run on Intel, Alpha, PowerPC, Sparc, Mac, and a few others. In addition there is abundant free support in the form of mailing lists, usenet, and IRC. For more info check out http://www.linux.org.

Chris



http://Yost.com/Misc/web-redirection.html - this page
1997-09-18 Created
1999-11-06 Modified
Part of Dave Yost's Web site - Please email me if you link to or cite this page