Mike Schilli's Friendly Neighborhood Perl Shop

CPAN Modules
Articles in English
Articles in German
Mike's Script Archive
English-Japanese Translation Trainer
Adventures with O'Reilly's Safari
10 Easy Steps to Become a California Driver
Unofficial perlmonks.com IRC Channel
My Collection of Outage Pages
Prisma (Computer Club Deutschland)
Mike's Monologues
Mike's Script Archive: relay

relay - Start a relaying HTTP server, forwarding requests


    relay - Start a relaying HTTP server, forwarding requests




    relay localport relayhost relayport
    localport: Port for the relay server to listen on
    relayhost: Host to forward requests to
    releayport: Port to forward requests to


This relay server is a proxy, listening to a port on the local host and forwarding all incoming requests to a different host on a different port. This is useful for simulating a server running under a different domain that it's actually running on. It's also called ``Poor man's DNS entry'', because you can use this without waking up the sysadm dogs and ask them to create a DNS CNAME for you.


To start a relay server on the local host, listening to port 8000 and forwarding requests to www.other.com:80, use this:

    relay 8000 www.other.com 80

This way, if you go to http://localhost:8000 with a browser, it'll effectively to http://www.other.com. Be aware that there's no redirection going on -- you browser will still display http://localhost:8000, while you're operating on http://www.other.com.


Copyright 2002 by Mike Schilli, all rights reserved. This program is free software, you can redistribute it and/or modify it under the same terms as Perl itself.


2001, Mike Schilli <m@perlmeister.com>

Latest update: 20-Oct-2013