/sys/lib/httpd.rewrite
/usr/bob/www/etc/rewrite
/sys/lib/httpd.rewrite
2003/02/11 Update
/sys/lib/httpd.rewrite
pegasus.goodwill.comAnd we assume five persons:
alice bob carol david emily
alice
wants to have her web page in pegasus
, that is she want to have following URI:bob
administrates document of real host. The URI is:https
should be used for the access to http://pegasus.goodwill.com/private
.carol
hopes to have virtual host car.goodwill.com
in this server and wishes to make use of the host for sales. She has a plan to use two protocols http
and https
and want to have two directories for each protocols.david
was a user of this server and now have his home page in http://www.eecs.harvard.edu/~david
. He want to redirect clients to his new address.emily
was a user of this server but now she is absent. bob
want to announce clients who is accessing her page that she is removed from the server.scheme://host[:port][/path][;params][?query]where
[ ]
is meta symbol that denotes inside of this symbol can be omitted.scheme
is http
or https
host
is a domain name of the server. The name must be registered to DNS.port
is a decimal number. if it is omitted then 80 is assumed for http
and 443 is assumed for https
path
is relative path from document rootparams
are defined in HTTP but not be used in major web server such as Apache. Pegasus uses params
as arguments for CGI. On the other hand query
is passed to CGI as an environment parameter. Here you don't need to know the format of params
and query
except that space characters are not be included in them.~user
in URI, where user
is a user name of the system. That is, ~user
is expressed as a directory under document root of the host. However implementation need not keep ~user
under document root. Rather it would be convenient to have user's document in the directory of the user.
/sys/lib/httpd.rewrite
/sys/lib/httpd.rewrite
for our case study.# pattern replacement http://car */usr/carol/www https://car */usr/carol/https /~david http://www.eecs.harvard.edu/~david /~emily */usr/bob/www_removed /private https://pegasus.goodwill.com/private / */usr/bob/wwwThe lines in this file consist of two fields except comment line. Fields are separated by spaces.
The first field is a pattern of request. The request is limited only to http
and https
. host
is the name of real host or virtual host. Note that host
is not full name of the domain.
/
then the request is regarded as the request to real host or user. That is, we regard scheme://host[:port]
is omitted, where host
is the name of real host.
In second field:
*
, web root is specifiedscheme
, redirect client to this URI/
is not described here. I would like to examine the real needs before I specify such a field.
If the requested URI matches the first field, then we have two cases:
*
, the extra portion of matched path is passed to the name space that is specified by second field.*
, the extra portion of matched path is added to the second fields and redirected to the clienthttp
or https
are for real host or virtual hosts/~
are for users/
and not /~
are for real hostscheme
are compared with the request. If no lines are matched, then lines beginning with /
are examined./path
that begins with /~
does not match /
/
as the first field must be placed at the end
If there is no field in /sys/lib/httpd.rewrite
that matches with URI, then Pegasus examines the possibility that the request is to the user.
$web
), and can have doc
, etc
and bin
under the directory. doc
is the place where document is located, etc
is the place where access control files such as rewrite
, allow
, passwd
and handler
are located, and bin
is the place where CGI files are located./sys/lib/httpd.rewrite
. For example, assume bob
administrate the the document of real host and carol
administrate the the document of virtual host car
. Then web root is specified in the second field using *
followed by the directory path like this:http://car */usr/carol/www https://car */usr/carol/https / */usr/bob/wwwIn this case,
carol
are given two web root /usr/carol/www
and usr/carol/https
for her virtual host car
.alice
can have their personal home page of URI:http://pegasus.goodwill.com/~alicewithout setting in
/sys/lib/httpd.rewrite
if she has $home/web/doc
. $home/web
is her web root.
2003/02/11 Update
car.goodwill.com
can be simplly car
if it in in pegasus.goodwill.com
.pegasus.goodwill.org
must be written as it is if it is in server pegasus.goodwill.com
./usr/bob/www/etc/rewrite
/usr/bob/www/etc/rewrite
is read after /sys/lib/httpd.rewrite
. Expression/private https://pegasus.goodwill.com/privatewill be considered in
$web/etc/rewrite
.
/sys/lib/httpd.rewrite
#
are comment[ ]
denotes we can omit what is inside of this symbols|
denotes selection:=
denotes substitution1. scheme://host[:port] 2. /pathwhere
scheme := http | https
host ::
host name | full host name | IPport ::
port numberpath ::
path to documentscheme
and host
port
for 80
and 443
1. scheme://hostdom[:port][/path][;params][?query] 2. */pathwhere
params := param[;params]
scheme ::
any schemehostdom ::
full name of the host (pegasus.goodwill.com
for example)port ::
port numberpath ::
path to the documentparams ::
argument list that is passed to CGIquery ::
query string