nsvhr -- Virtual Hosting Redirector Module

$Header: /cvsroot/aolserver/nsvhr/nsvhr.html,v 1.1.1.1 2001/01/31 21:01:56 kriston Exp $

Theory of Operation
Known Issues
Sample Configuration


Theory of Operation

Despite its name, the nsvhr module is a proxy that connects to remote hosts depending on the "Host:" header presented by the client.  It can connect to these remote hosts using nssockor nsunix.

Known Issues

On the proxied remote host, commands like [ns_conn location] might be misleading.

It's not clear whether the "Host:" header is properly rewritten for the remote host.

The code that processes the "Host:" header from the client is unsmart.

Users seem to habitually confuse nsvhr with the old AOLserver 2.x Virtual Hosting feature.  These are completely different concepts that have little to do with each other.  The sole purpose of nsvhr is to proxy connections to other servers based on the "Host:" header presented by the client.  The nsvhr module is not designed for in-process virtual hosting a la AOLserver 2.x.

Sample Configuration


Proxying via tcp (the default) is very simple to set up.  No special
modules need to be loaded (it uses the already-loaded nssock).  It is
less efficient than nsunix and but is the preferred method to
communicate with web servers on a different machine.

Proxying over a unix domain socket requires loading the nsunix.so
module.  Proxying this way is more efficient since the file descriptor
of the socket of the incoming connection is passed to nsunix.so in a
message over the unix domain socket.  Then the client communicates
directly with the nsunix.so module and this module is no longer
involved.  This is the preferred method to proxy to web servers
running on the same machine.
# 
# Virtual Hosting redirector -- nsvhr 
# 
ns_section "ns/server/${servername}/module/nsvhr" 
ns_param   busyurl         "url"     ;# Redirect here if back-end times out 
ns_param   errorurl        "url"     ;# Redirect here on proxy errors 
ns_param   method          "GET"     ;# Methods allowed to proxy 
ns_param   method          "POST"    ;# Methods allowed to proxy (can have >1) 
ns_param   timeout         30        ;# Timeout waiting for back-end 
 
# Register hosts to proxy 
ns_section "ns/server/${servername}/module/nsvhr/maps" 
ns_param   "www.tcpsocket.com"    "http://127.0.0.0:2000" ;# HTTP proxy 
ns_param   "www.domainsocket.com" "unix://somehost"       ;# Domain socket